@@ -288,28 +288,28 @@ public function editor_assets() {
288288 $ form_subject = $ form ->default_subject ();
289289 $ success_text = $ form ->default_success_text ();
290290
291- wp_localize_script (
292- 'coblocks-editor ' ,
293- 'coblocksBlockData ' ,
294- array (
295- 'form ' => array (
296- 'adminEmail ' => $ email_to ,
297- 'emailSubject ' => $ form_subject ,
298- 'successText ' => $ success_text ,
299- ),
300- 'cropSettingsOriginalImageNonce ' => wp_create_nonce ( 'cropSettingsOriginalImageNonce ' ),
301- 'cropSettingsNonce ' => wp_create_nonce ( 'cropSettingsNonce ' ),
302- 'labsSiteDesignNonce ' => wp_create_nonce ( 'labsSiteDesignNonce ' ),
303- 'bundledIconsEnabled ' => $ bundled_icons_enabled ,
304- 'customIcons ' => $ this ->get_custom_icons (),
305- 'customIconConfigExists ' => file_exists ( get_stylesheet_directory () . '/coblocks/icons/config.json ' ),
306- 'typographyControlsEnabled ' => $ typography_controls_enabled ,
307- 'animationControlsEnabled ' => $ animation_controls_enabled ,
308- 'localeCode ' => get_locale (),
309- 'baseApiNamespace ' => COBLOCKS_API_NAMESPACE ,
310- )
291+ $ localize_data = array (
292+ 'form ' => array (
293+ 'adminEmail ' => $ email_to ,
294+ 'emailSubject ' => $ form_subject ,
295+ 'successText ' => $ success_text ,
296+ ),
297+ 'labsSiteDesignNonce ' => wp_create_nonce ( 'labsSiteDesignNonce ' ),
298+ 'bundledIconsEnabled ' => $ bundled_icons_enabled ,
299+ 'customIcons ' => $ this ->get_custom_icons (),
300+ 'customIconConfigExists ' => file_exists ( get_stylesheet_directory () . '/coblocks/icons/config.json ' ),
301+ 'typographyControlsEnabled ' => $ typography_controls_enabled ,
302+ 'animationControlsEnabled ' => $ animation_controls_enabled ,
303+ 'localeCode ' => get_locale (),
304+ 'baseApiNamespace ' => COBLOCKS_API_NAMESPACE ,
311305 );
312306
307+ if ( current_user_can ( 'upload_files ' ) ) {
308+ $ localize_data ['cropSettingsOriginalImageNonce ' ] = wp_create_nonce ( 'cropSettingsOriginalImageNonce ' );
309+ $ localize_data ['cropSettingsNonce ' ] = wp_create_nonce ( 'cropSettingsNonce ' );
310+ }
311+
312+ wp_localize_script ( 'coblocks-editor ' , 'coblocksBlockData ' , $ localize_data );
313313 }
314314
315315 /**
0 commit comments