• Hi there. I’m really enjoying using lazy blocks on a site I’m developing, but the latest update seems to have brought some unexpected effects. I was relying on being able to customise the HTML of each block output, using classes and data-attributes, etc.

    The update seems to include ‘added new attribute blockUniqueClass that will adds automatically on each Lazy block’ and ‘changed output for lazy blocks – always added wrapper with block class’, however this seems to happen as a new div that gets wrapped around whatever custom HTML is being used. For me this has totally broken my page layout. Was this intentional? Could it not be applied to the outermost element in the template, or something? Being able to have FULL control over the HTML is what made this plugin great, but if things change so quickly it will be unsuitable for production use.

    Any info around the change would be well received. Sorry to sound negative, I otherwise really love the plugin.

    Thanks

    BTW for anyone who needs a quick and dirty solution, in jQuery:
    $("div[class^='wp-block-lazyblock-'],div[class*=' wp-block-lazyblock-']").contents().unwrap();

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Nikita

    (@nko)

    Hi.

    I apologize for this.

    I wanted to add an additional option, so users can disable wrapper, but I think this option will be a bit confusing. As for me, there is nothing, that can break the layout, because this is just a wrapper, without additional styles, but with additional classes. I understand that it may break some existing blocks, but most of it will remain to function.

    The reason why we need to add this wrapper – block classname (like wp-block-lazyblock-test) + unique classname (like wp-block-lazyblock-test-1eIFW5). And these classnames will be added both in editor block wrapper and in frontend wrapper.

    Look at this example:

    1. Lazy block in editor – https://snap.nkdev.info/2019-01-27-1548605080.png
    2. Lazy block on frontend – https://snap.nkdev.info/2019-01-27-1548605165.png

    As you can see, in Editor wrapper wraps a whole block (controls + preview), so we can change styles of controls and other Lazy block styles (in the previous example you can see that block doesn’t have default lazy block background and title), and using these classes I can easily add style for my “divider” both in editor and on frontend. Ok, we can make the same with previous lazy blocks version, but we can do this with static blocks only, that don’t have Inner Blocks inside. See this issue https://github.com/nk-o/lazy-blocks/issues/31 . The user wanted to fill a whole block, but this was not possible with the previous plugin version.

    If you have any interesting solutions, I’m ready to look at it.

    p.s. for the future updates I want to test the new way to output values of controls. We can easily add attributes on the wrapper.

    p.s.s. I can add WP Filters for output code.

    Plugin Author Nikita

    (@nko)

    Thread Starter tank commander gibbons

    (@scannermobs)

    Wow, thanks for acting upon this so quickly! The filter works perfectly for me. If in the future the function of the filter could be built into the UI under ‘Additional settings’, as a checkbox toggle, this would be the only further improvement I can think of. I can totally understand that for some people they would prefer to have the wrapper, but optional is even better.

    Much, much appreciated.

    All the best

    Good move adding the filter! One of my usage cases is a block for starting a new section. It starts with closing tags for the previous section, so obviously a wrapper around that breaks it. Thanks, Lazy Blocks is awesome!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘New version has messed things up for me’ is closed to new replies.