• Resolved rastatux

    (@rastatux)


    Hello everybody,

    I need some help. I’m using a Wrapper for other blocks via “<InnerBlocks.Content />”. The save function looks like this:

    return (
                <div class="container mb-5">
                    <div class="row">
                        <InnerBlocks.Content />
                    </div>
                </div>
        );

    If I add one Block, it works on saving. But as soon as I have two blocks, an error gets thrown:

    
    Block validation: Block validation failed for <code>projectx/projectswrapper</code> 
    
    Content generated by <code>save</code> function:
    
    <div class="container mb-5" class="wp-block-projectx-projectswrapper"><div class="row"></div></div>
    
    Content retrieved from post body:
    
    <div class="container mb-5" class="wp-block-projectx-projectswrapper"><div class="row">
    --- LOT'S OF LINEBREAKS HERE ---
    </div></div>

    So there gets empty space created by the blocks within the InnerBlocks Wrapper. Could anybody give me a hint, why this happens?

    Thanks in Advance,

    Jonas aka. rastatux

    • This topic was modified 2 years, 9 months ago by rastatux.
    • This topic was modified 2 years, 9 months ago by rastatux.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Kathryn Presner

    (@zoonini)

    Hi @rastatux – I think it would be helpful to better understand the context for your report. Are you building your own custom theme, for example? A custom template in a premade block (FSE) theme, and if so, what’s the name of the theme? Something else?

    Once I better understand the context, I can try to get some other eyes on this. Thanks!

    Moderator Kathryn Presner

    (@zoonini)

    Also, I found this ticket in GitHub that could be related – maybe have a peek and see if it sheds any light?

    https://github.com/WordPress/gutenberg/issues/10308

    Thread Starter rastatux

    (@rastatux)

    Hello Kathryn P.,

    Thanks for your reply! Yes, I’m creating my own WP theme as well as my own Gutenberg Blocks. One is a wrapper as I said, the other one can be repeated inside. Both are custom blocks by me.

    I reviewed the issue, I’m not sure if it is related. My content does not disappear, it is still there. But I have to do the “restore block” every time I load the page, since there are empty lines within the InnerBlocks Wrapper. It only happens, when there is more than one children in the wrapper, as said. I tried to delete empty lines in the children block, but that doesn’t help.

    Thread Starter rastatux

    (@rastatux)

    Okay wait, nevermind.

    Actually, the last comment of the Issue did actually fix my problem – Adding className everywhere. Thank you!

    Moderator Kathryn Presner

    (@zoonini)

    Actually, the last comment of the Issue did actually fix my problem – Adding className everywhere. Thank you!

    Super, glad that worked, and you’re very welcome!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Block Wrapper always creates empty space’ is closed to new replies.