PrettyBlocks
Events

#
Events

Since version 3.1.0, PrettyBlocks has introduced Events that are sent to the iframe from the back office. Currently, only one Event is sent, which is updatePrettyBlocks.

Here's an example that you can implement in your Block on a .tpl file:

1document.addEventListener('updatePrettyBlocks', function(event) {
2const blockId = event.detail.block.id_prettyblocks;
3 if (blockId === parseInt('{/literal}{$block.id_prettyblocks}{literal}')) {
4 // do the magic...
5 }
6});

#
CSS

PrettyBlocks now implements a CSS layer to manage the style of its own components