@@ -52,6 +52,9 @@ public static function register_block() {
5252 add_filter ( 'pre_render_block ' , array ( __CLASS__ , 'pre_render_contact_form ' ), 10 , 3 );
5353
5454 add_filter ( 'block_editor_rest_api_preload_paths ' , array ( __CLASS__ , 'preload_endpoints ' ) );
55+
56+ // Load scripts for the editing interface
57+ add_action ( 'enqueue_block_editor_assets ' , array ( __CLASS__ , 'load_editor_scripts ' ), 9 );
5558 }
5659 /**
5760 * Register the contact form block feature flag.
@@ -824,26 +827,6 @@ private static function render_synced_form( $ref_id ) {
824827 return $ output ;
825828 }
826829
827- /**
828- * Load editor styles for the block.
829- * These are loaded via enqueue_block_assets to ensure proper loading in the editor iframe context.
830- */
831- public static function load_editor_styles () {
832-
833- $ handle = 'jp-forms-blocks ' ;
834-
835- Assets::register_script (
836- $ handle ,
837- '../../../dist/blocks/editor.js ' ,
838- __FILE__ ,
839- array (
840- 'css_path ' => '../../../dist/blocks/editor.css ' ,
841- 'textdomain ' => 'jetpack-forms ' ,
842- )
843- );
844- wp_enqueue_style ( 'jp-forms-blocks ' );
845- }
846-
847830 /**
848831 * Loads scripts
849832 */
@@ -856,6 +839,8 @@ public static function load_editor_scripts() {
856839
857840 $ handle = 'jp-forms-blocks ' ;
858841
842+ wp_enqueue_style ( 'jp-forms-blocks ' );
843+
859844 Assets::register_script (
860845 $ handle ,
861846 '../../../dist/blocks/editor.js ' ,
@@ -865,8 +850,7 @@ public static function load_editor_scripts() {
865850 'in_footer ' => true ,
866851 'textdomain ' => 'jetpack-forms ' ,
867852 'enqueue ' => true ,
868- // Editor styles are loaded separately, see load_editor_styles().
869- 'css_path ' => null ,
853+ 'css_path ' => '../../../dist/blocks/editor.css ' ,
870854 )
871855 );
872856
0 commit comments