diff --git a/CHANGELOG.md b/CHANGELOG.md index 0578a3f0..4d6c757f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Fixed a bug where custom `toolbar` config settings were getting ignored. ([#522](https://github.com/craftcms/ckeditor/issues/522)) - Fixed a bug where files uploaded to Assets fields could also be added to nearby CKEditor fields. ([#523](https://github.com/craftcms/ckeditor/issues/523)) +- Fixed an error that could occur when registering a custom CKEditor plugin. ([#525](https://github.com/craftcms/ckeditor/issues/525)) ## 5.1.0 - 2026-03-05 diff --git a/src/helpers/CkeditorConfig.php b/src/helpers/CkeditorConfig.php index b739b586..6e25b1f2 100644 --- a/src/helpers/CkeditorConfig.php +++ b/src/helpers/CkeditorConfig.php @@ -214,12 +214,7 @@ public static function registerPackage(string $name, array $config): void $plugins = $config['plugins'] ?? []; $toolbarItems = $config['toolbarItems'] ?? []; - if (!isset(self::$pluginsByPackage[$name])) { - self::$pluginsByPackage[$name] = $plugins; - } else { - self::$pluginsByPackage[$name] = array_merge(self::$pluginsByPackage[$name], $plugins); - } - + self::$pluginsByPackage[$name] = $plugins; self::$toolbarItems[] = $toolbarItems; self::$pluginButtonMap[] = [ 'plugins' => $plugins,