diff --git a/assets/dev/js/admin/hello-admin.scss b/assets/dev/js/admin/hello-admin.scss index 72bbf348..548c4dee 100644 --- a/assets/dev/js/admin/hello-admin.scss +++ b/assets/dev/js/admin/hello-admin.scss @@ -42,6 +42,20 @@ background: #ffffff; } + .components-notice { + margin: 0; + margin-block-end: 20px; + + .dashicon { + padding-inline-end: 10px; + color: #f0b849; + } + + button { + display: none; + } + } + .code-example { display: inline-block; margin-block-end: 1.5rem; diff --git a/assets/dev/js/admin/pages/panels/scripts-styles.js b/assets/dev/js/admin/pages/panels/scripts-styles.js index 7cb7302f..70337210 100644 --- a/assets/dev/js/admin/pages/panels/scripts-styles.js +++ b/assets/dev/js/admin/pages/panels/scripts-styles.js @@ -1,29 +1,34 @@ import { __ } from '@wordpress/i18n'; import { SETTINGS } from '../settings.js'; -import { PanelBody, ToggleControl } from '@wordpress/components'; +import { PanelBody, ToggleControl, Notice, Dashicon } from '@wordpress/components'; export const PanelScriptsStyles = ( { settingsData, updateSettings } ) => { return ( + + + { __( 'Be cautious, disabling some of the following options may break your website.', 'hello-elementor' ) } + + updateSettings( SETTINGS.EMOJI, value ) } /> updateSettings( SETTINGS.OEMBED_SCRIPT, value ) } + label={ __( 'Unregister wp-embed script', 'hello-elementor' ) } + help={ __( 'Disable the script which is responsible for embedding external resources.', 'hello-elementor' ) } + checked={ !! settingsData[ SETTINGS.WP_EMBED_SCRIPT ] || false } + onChange={ ( value ) => updateSettings( SETTINGS.WP_EMBED_SCRIPT, value ) } /> - <script type="text/javascript" src="https://{ window.location.hostname }/wp-includes/js/wp-embeds.min.js" /> + <script type="text/javascript" src="https://{ window.location.hostname }/wp-includes/js/wp-embed.min.js" /> updateSettings( SETTINGS.CLASSIC_THEME_STYLES, value ) } /> @@ -31,14 +36,15 @@ export const PanelScriptsStyles = ( { settingsData, updateSettings } ) => { updateSettings( SETTINGS.GUTENBERG, value ) } /> + <link rel="stylesheet" href="http://dev.local/wp-includes/css/dist/block-library/style.css" /> updateSettings( SETTINGS.HELLO_STYLE, value ) } /> @@ -46,7 +52,7 @@ export const PanelScriptsStyles = ( { settingsData, updateSettings } ) => { updateSettings( SETTINGS.HELLO_THEME, value ) } /> diff --git a/assets/dev/js/admin/pages/settings.js b/assets/dev/js/admin/pages/settings.js index e36aa2a1..54f47fcb 100644 --- a/assets/dev/js/admin/pages/settings.js +++ b/assets/dev/js/admin/pages/settings.js @@ -16,7 +16,7 @@ export const SETTINGS = { POST_COMMENTS_RSS: '_post_comments_rss', /* Scripts & Styles */ EMOJI: '_emoji', - OEMBED_SCRIPT: '_oembed_script', + WP_EMBED_SCRIPT: '_wp_embed_script', CLASSIC_THEME_STYLES: '_classic_theme_styles', GUTENBERG: '_gutenberg', HELLO_STYLE: '_hello_style', diff --git a/includes/settings-functions.php b/includes/settings-functions.php index 887c7525..2a6d7217 100644 --- a/includes/settings-functions.php +++ b/includes/settings-functions.php @@ -95,7 +95,7 @@ function hello_elementor_tweak_settings() { 'POST_COMMENTS_RSS' => '_post_comments_rss', /* Scripts & Styles */ 'EMOJI' => '_emoji', - 'OEMBED_SCRIPT' => '_oembed_script', + 'WP_EMBED_SCRIPT' => '_wp_embed_script', 'CLASSIC_THEME_STYLES' => '_classic_theme_styles', 'GUTENBERG' => '_gutenberg', 'HELLO_STYLE' => '_hello_style', @@ -207,7 +207,7 @@ function hello_elementor_render_tweaks( $settings_group, $settings ) { remove_action( 'wp_print_styles', 'wp_enqueue_emoji_styles' ); // WP 6.4 and above } ); - hello_elementor_do_tweak( $settings_group . $settings['OEMBED_SCRIPT'], function() { + hello_elementor_do_tweak( $settings_group . $settings['WP_EMBED_SCRIPT'], function() { remove_action( 'wp_head', 'wp_oembed_add_host_js' ); add_action( 'wp_enqueue_scripts', function() { wp_deregister_script( 'wp-embed' ); diff --git a/readme.txt b/readme.txt index 7204cd03..19056d5c 100644 --- a/readme.txt +++ b/readme.txt @@ -52,7 +52,7 @@ Source: https://stocksnap.io/photo/4B83RD7BV9 * New: Option to remove site comments RSS feed. * New: Option to remove post comments RSS feed. * New: Option to unregister Emoji scripts & styles. -* New: Option to unregister oEmbed script. +* New: Option to unregister wp-embed script. * New: Option to unregister classic-theme styles. * New: Option to unregister Gutenberg styles. * New: Option to unregister Hello style.css.