is_block_editor()) { return; } $post_id = get_the_ID(); if ($post_id) { $is_elementor = get_post_meta($post_id, '_elementor_edit_mode', true) === 'builder'; if ($is_elementor) { return; } } $asset_file = plugin_dir_path(__FILE__) . 'build/index.asset.php'; $asset = file_exists($asset_file) ? require $asset_file : ['dependencies' => [], 'version' => '1.0.0']; wp_enqueue_script( 'ailm-gutenberg-sidebar', plugin_dir_url(__FILE__) . 'build/index.js', $asset['dependencies'], $asset['version'], true ); wp_localize_script('ailm-gutenberg-sidebar', 'ailmGutenberg', [ 'rest_url' => rest_url('linkmesh/v1/'), 'nonce' => wp_create_nonce('wp_rest'), // Bulk Settings exposed to the inline editor so the Gutenberg // outbound flow (update_dom=false) can enforce the same rules as // the bulk engine: excluded HTML areas, Skip Intro, Min Gap. 'excluded_html' => get_option('ailm_excluded_html', ['h1-h6', 'code', 'blockquote']), 'skip_chars' => (int) get_option('ailm_skip_chars', 100), 'min_gap' => (int) get_option('ailm_min_gap', 200), ]); } /** * Register REST API routes for the Gutenberg sidebar. * * @return void */ public function register_rest_routes() { require_once plugin_dir_path(__FILE__) . 'class-ailm-gutenberg-rest-api.php'; AILM_Gutenberg_REST_API::register_routes(); } }