You haven’t shared the action you’re using to enqueue your script, but I’d double check you’re using admin_enqueue_scripts
and not wp_enqueue_scripts
.
eg:
add_action('admin_enqueue_scripts', 'your_function');
function your_function() {
wp_enqueue_script( 'testJs', get_bloginfo( 'stylesheet_directory' ) . '/js/test.js', array( 'jquery'));
}
I usually achieve this using CSS for ease, but this method will remove hover events too, which you might not want!
In the custom block CSS file:
.acf-block-preview .your-block-name {
pointer-events: none;
}