admin管理员组

文章数量:1334389

Is it possible to apply inline styles to all blocks via filters? Or do only some blocks support it? basically I want to add the ability of adding a background image to a single column. So I added an extra attribute to store the background img url (named backgroundImg) and tested that its saved.

I am trying to use blocks.getSaveContent.extraProps to apply the background image to the inline style like so..

if ("wp-block-column" === props.className) {
    return lodash.merge(props, {
        style: {
            backgroundImage: "url(" + props.backgroundImg + ")",
        },
    });
}

When I run this however the background IMG url is 'undefined'. However I have tested and know that props.backgroundImg is being saved. I can add more of my code as needed, but any ideas on why it isn't applying the saved url?

本文标签: filtersInline Styles on all native blocks