WIP: Component blocks, element scripts aren't enqueued in the editor

For Bricks elements that enqueue their own scripts, via the enqueue_scripts() method from Bricks’ element API… the enqueuing only happens on the front end or when in Bricks builder but not when they’re inside of a component that is being used as a block when viewing inside the block editor. This can result in broken layouts and inaccessible content when viewing inside the block editor.

As a simple example… the issue can be seen with the nestable slider or the image gallery when set to use masonry.

To reproduce, add a nestable slider or gallery set to masonry inside of a component and turn into a ‘block’. Then add that block to any post / page.

Screen recording showing the issue - Viewing slider & masonry in editor

Notice the slider isn’t initialised and neither is the masonry layout when viewing in the editor (due to the splide and isotope / photoswipe not being enqueued).

It’s not just these two element, it’s any elements using enqueue_scripts().

(Most likely enqueue_scripts() in the API just needs to be added to a gutenberg / block editor specific hook to ensure it is working in the editor view also)

Hi @wplit,

thank you. I was able to replicate it and I’ve added it to the internal bug tracker.

Matej

Do we have an update here or a work around in the mean time?
Trying to enqueue splide so Nested Slider works in Gutenberg.

Not yet, not that I’m aware of.

Best regards,
Matej

Seems like a fairly important one to resolve amigo.

Hi,

Any information about this?

Thank you!

Hi @danielvigh,

no new news to share about this one.

Matej

Hi @Matej,

Thank you for your response. Unfortunately, the bug is still present in version 2.3.1 as well.

I’ve built an image carousel component using a Carousel element with an Image Gallery prop bound to it. It works correctly inside the Bricks admin, but on the frontend and in the Gutenberg editor the carousel does not load at all — no images, no arrows, nothing is displayed.

This is unfortunately a problem as we have a website that is about to be handed over to a client. Is there any temporary workaround available so our client can use this component in the meantime?

Thanks in advance,
Daniel

Shared with Zight

Hi @danielvigh,

I’ve checked out internal task, but there was no mention of temporary workaround, so I assume we don’t have it yet.

Maybe (and I’m just guessing now, as I not checked deeply into this task), you can load missing scripts manually instead.

Matej