Why is wordpress suddenly stripping away all newline characters and how to disable this?

I’ve spent about 3 hours trying out various functions to figure out why the newline characters are being removed every time I save.

How do I figure out why is wordpress suddenly stripping away newline characters? I have not installed any plugins. How can I get newline characters to show up on my site without converting all blocks to HTML and modifying everything in code?

Go to Source
Author: Mugen

Inline Styles on all native blocks

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?

Go to Source
Author: user13989254

Where to find documentation for CPT block template? (PHP)

I have been searching for a day and still carn’t seem to find the right documentation for what arguments I can pass to core components when attempting to configure a CPT block template in php. This is what I have but I want to take this further by nesting buttons and custom html etc. but carnt find the docs I need.

'template' => array(
    array( 'core/columns', array(), array(
        array( 'core/column', array("width" => "60"), array(
            array( 'core/image', array() ),
        ) ),
        array( 'core/column', array("width" => "40"), array(
            array( 'core/image', array() ),
            array( 'core/heading', array(
                'placeholder' => 'Add a inner paragraph'
            ) ),
        ) ),
    )
)       

Found everything needed to create bespoke blocks in JSX but blegh, Not got the time to learn the wizardry ways of JSX just yet and I dont really want new blocks just want the existing one bound as a template to a custom post type.

A good way to example my question, how did this person find the answer on how set the width of this template columns.

How to set column widths in a CPT block template?

How did the person find this answer ? did they have to dive in to the JS scripts of the component and work it out or is there some documentation on this or am I missing something all together.

Any help would be greatly appreciated.

Go to Source
Author: Johnny