diff --git a/src/Front/FrontStyle.php b/src/Front/FrontStyle.php index 4c9c3fd..6ddd866 100644 --- a/src/Front/FrontStyle.php +++ b/src/Front/FrontStyle.php @@ -39,6 +39,7 @@ public function __construct() { $this->front_static_url = Config::get_option("editor_addres", "editor_style"); add_action("wp_enqueue_scripts", array($this, "enqueue_front_scripts")); + add_action("wp_enqueue_scripts", array($this, "dequeue_bloat_scripts")); } /** @@ -55,10 +56,21 @@ public function enqueue_front_scripts() { $jQueryName = "jQuery-CDN"; } - wp_enqueue_script("Front_Style", $this->front_static_url . "/assets/FrontStyle/frontstyle.min.js", array($jQueryName), $this->version, true); + wp_enqueue_style("Front_Style", $this->front_static_url . "/assets/FrontStyle/FrontStyle.min.css", array(), WP_EDITORMD_VER, "all"); + wp_enqueue_script("Front_Style", $this->front_static_url . "/assets/FrontStyle/FrontStyle.min.js", array($jQueryName), $this->version, true); wp_localize_script("Front_Style", "FrontStyle", array( "openLinkInNewTab" => Config::get_option("open_in_new_tab", "editor_basics") // 在新标签页打开链接 )); } + + /** + * 禁用不需要的脚本文件(Gutenberg引入) + * Ref issue: https://github.com/LuRenJiasWorld/WP-Editor.md/issues/560 + */ + public function dequeue_bloat_scripts() { + wp_dequeue_style("wp-block-library"); + wp_dequeue_style("wp-block-library-theme"); + wp_dequeue_style("wc-blocks-style"); + } }