Since this relates to functionality that is specific to the Advanced Custom Fields plugin, I would recommend going through their support channels for this question. Here’s a place to start:
https://www.ads-software.com/support/plugin/advanced-custom-fields/
]]>When you say “preview mode” you mean clicking the Preview button at the top of the editor and viewing the post in a new tab, right?
The first thing I would try is adding your scripts function to an additional hook so that they get enqueued on the front end. Right now I suspect they only get enqueued in the editor interface. So something like:
add_action( 'wp_enqueue_scripts', 'my_block_plugin_editor_scripts' );
The block preview is what I’m describing; not previewing the post on the front-end. Here’s a screenshot: https://www.dropbox.com/s/ptbiwxo3oancopt/Screen%20Shot%202019-05-29%20at%204.57.11%20PM.png?dl=0
Can you confirm that the way I have enqueued the script will not apply to the block preview and only the block editor? It’s in my original post.
]]>So, just spitballing a couple more ideas here:
1) The way the scripts are enqueued looks ok to me, with one exception: it doesn’t appear that you have jQuery listed as a dependency for your core Cycle2 script. That may or may not make a difference, because it seems like jQuery would already be loaded anyway, but it wouldn’t hurt to try adding it to the array.
2) I don’t know exactly how ACF’s block preview works, but if it’s rendering the HTML markup on the spot, when you click that Preview button, it could be that Cycle2 isn’t picking up on your cycle-slideshow
class because it’s already been initialized at that point.
<script src="<?php echo bloginfo('template_url'); ?>/scripts/jquery.cycle2.min.js" type="text/javascript" defer></script>
]]>