Disable scripts when using the Bricks editor

Hello, is there a way to prevent scripts from loading when using the Brick editor? So any page that ends with /?bricks=run

Usage case is a chatbot script that has been added right before the </body> tag. This chatbot is visible twice when editing a page / template in the editor and is sometimes in the way of other actions like inserting an image.

Thanks in advance!

Second this, Bit assist is overriding structure panel’s context menu.
Is there a hook or something other plugin could use to add an option to exclude their scripts from loading in Bricks?

If the plugin is enqueuing the JS properly using …

wp_enqueue_script()

Then it can be be disabled with…

wp_dequeue_script( 'script-handle-goes-here' );

Paired with Brick’s condition to check if currently inside builder before dequeueing it.

if ( bricks_is_builder() ) {

 /* Remove scripts here */

}

But to find where/when the script is added, you’d need to go through the plugins code or ask the devs.

I’ve found fastest way to find where a plugin is enqueuing styles/scripts is to download plugin locally, then search plugin’s local files for your keyword :+1::+1:

there is undocumented hook for it

add_filter( 'bricks/elements/{element_name}/controls', function( $scripts ) {
	// your code here...
	return $scripts;
});