From bf11a967a1779ff2c31003579a7f8fb7a21d1ac4 Mon Sep 17 00:00:00 2001 From: Geoff Dusome Date: Tue, 6 Jun 2023 16:40:10 -0400 Subject: [PATCH] fix asset enqueuing issues --- README.txt | 5 ++++- block-editor-custom-alignments.php | 8 ++++---- package-lock.json | 2 +- package.json | 2 +- webpack.config.js | 14 +++----------- 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/README.txt b/README.txt index 66107c6..b609212 100644 --- a/README.txt +++ b/README.txt @@ -4,7 +4,7 @@ Donate link: https://tri.be Tags: blocks, editor, alignment Requires at least: 6.0 Tested up to: 6.2 -Stable tag: 1.0.4 +Stable tag: 1.0.5 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -21,6 +21,9 @@ The plugin runs off of an `_experimentalLayout` attribute in `theme.json` that a == Changelog == += 1.0.5 = +* Use `enqueue_block_editor_assets` instead of `admin_enqueue_scripts` to prevent dependency errors + = 1.0.4 = * Use `wp_remote_get` for grabbing `theme.json` to prevent SSL errors diff --git a/block-editor-custom-alignments.php b/block-editor-custom-alignments.php index e0d895b..7781241 100644 --- a/block-editor-custom-alignments.php +++ b/block-editor-custom-alignments.php @@ -13,7 +13,7 @@ * Plugin Name: Block Editor Custom Alignments * Plugin URI: https://https://github.com/moderntribe/block-editor-custom-alignments * Description: Allows developers to add custom alignments to `theme.json` for use in the block editor. - * Version: 1.0.4 + * Version: 1.0.5 * Author: Modern Tribe * Author URI: https://tri.be * License: GPL-2.0+ @@ -54,7 +54,7 @@ class Block_Editor_Custom_Alignments { public function __construct() { global $pagenow; - $this->version = '1.0.4'; + $this->version = '1.0.5'; $this->name = 'block-editor-custom-alignments'; $this->base_url = trailingslashit( plugin_dir_url( __FILE__ ) ); $this->theme_json = $this->block_editor_custom_alignments_theme_json(); @@ -66,8 +66,8 @@ public function __construct() { $this->dependencies[] = 'wp-edit-post'; } - add_action( 'admin_enqueue_scripts', [ $this, 'block_editor_custom_alignments_admin_scripts' ], 10 ); - add_action( 'admin_enqueue_scripts', [ $this, 'block_editor_custom_alignments_admin_styles' ], 10 ); + add_action( 'enqueue_block_editor_assets', [ $this, 'block_editor_custom_alignments_admin_scripts' ], 10 ); + add_action( 'enqueue_block_editor_assets', [ $this, 'block_editor_custom_alignments_admin_styles' ], 10 ); add_action( 'wp_enqueue_scripts', [ $this, 'block_editor_custom_alignments_public_styles' ], 10 ); } diff --git a/package-lock.json b/package-lock.json index 22e5ef1..2e1684e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "block-editor-custom-alignments", - "version": "1.0.4", + "version": "1.0.5", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index b64d949..2ed8dd0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "block-editor-custom-alignments", - "version": "1.0.4", + "version": "1.0.5", "description": "Allows developers to add custom alignments to `theme.json` for use in the block editor.", "author": "Modern Tribe ", "license": "GPL-2.0-or-later", diff --git a/webpack.config.js b/webpack.config.js index 3e53605..cee6fef 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -20,23 +20,15 @@ const RemoveEmptyScriptsPlugin = require( 'webpack-remove-empty-scripts' ); */ const assetEntryPoints = () => { return { - 'admin': resolve( - pkg.directories.admin, - '', - 'admin.js' - ), - 'public': resolve( - pkg.directories.public, - '', - 'public.js' - ) + admin: resolve( pkg.directories.admin, '', 'admin.js' ), + public: resolve( pkg.directories.public, '', 'public.js' ), }; }; module.exports = { ...defaultConfig, entry: { - ...assetEntryPoints() + ...assetEntryPoints(), }, output: { ...defaultConfig.output,