@@ -48,9 +48,21 @@ public function boot( Service_Container $container ): void {
4848 $ this ->register_custom_block_styles ();
4949
5050 /**
51- * Load editor JS for ADMIN
51+ * Load editor JS
52+ *
53+ * WP 6.3+ isolates the editor canvas in an iframe (`iframe[name="editor-canvas"]`).
54+ * This affects all blocks, but ACF Blocks V3 (`blockVersion: 3`) rely on it: their PHP
55+ * render templates (and ARI lazyload markup) are injected into that iframe on each preview
56+ * refresh — not into the admin shell where `enqueue_block_editor_assets` loads scripts.
57+ *
58+ * - `enqueue_block_editor_assets` → admin shell only (outside the iframe).
59+ * - `enqueue_block_assets` → iframe + front end (guarded with is_admin() below).
60+ *
61+ * lazySizes must therefore load via `enqueue_block_assets` to unveil `.lazyload` images
62+ * in ACF V3 block previews. Other blocks (e.g. ServerSideRender) may still work without
63+ * this, but ACF V3 previews will stay invisible until a DOM mutation triggers lazySizes.
5264 */
53- add_action ( 'enqueue_block_editor_assets ' , [ $ this , 'admin_editor_script ' ] );
65+ add_action ( 'enqueue_block_assets ' , [ $ this , 'admin_editor_script ' ] );
5466 /**
5567 * White list of gutenberg blocks
5668 */
@@ -77,6 +89,11 @@ private function style(): void {
7789 * Editor script
7890 */
7991 public function admin_editor_script (): void {
92+ // enqueue_block_assets also runs on the front end; skip outside wp-admin.
93+ if ( ! is_admin () ) {
94+ return ;
95+ }
96+
8097 $ file = $ this ->assets ->get_min_file ( 'editor.js ' ) ?: 'editor.js ' ;
8198 $ filepath = 'dist/ ' . $ file ;
8299
0 commit comments