0

I'm trying to make a Custom Gutenberg Block, but I'm having trouble with loading javascript that goes with this block.

On the front-end it works fine, but in the editor it seems that the script fires (even with DOMcontentloaded or window.onload) BEFORE the Gutenberg block itself is fully loaded.

Since my script targets an element in the block (which it can't find because the element hasn't loaded yet), it's not working correctly.

Any suggestions on how to make the script load AFTER the Custom Block has loaded fully in the editor?


(I'm using the ACF way of creating Custom blocks)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.