-
Notifications
You must be signed in to change notification settings - Fork 31
Description
Description
Hi, I am working on a custom plugin on the latest version. It is loaded in a craft module following the documentation :
if (Craft::$app->getRequest()->getIsCpRequest()) {
Plugin::registerCkeditorPackage(LexiqueAsset::class);
}And it is a basic config like in the documentation :
class LexiqueAsset extends BaseCkeditorPackageAsset
{
public $sourcePath = '@modules/ckeditor/resources/dist';
public string $namespace = '@akufen/ckeditor5-akfn-lexique';
public $js = [
['index.js', 'type' => 'module']
];
public array $pluginNames = ['AkfnLexique'];
public array $toolbarItems = ['akfnLexiqueButton'];
}I have some CkEditor fields with different configurations loaded in different matrix block in the same page using the custom plugin.
As soon as I have 2 Ckeditor opened I get the following error :
Uncaught SyntaxError: Identifier 'AkfnLexique' has already been declared
and I can see in the dom :
import { AkfnLexique, AkfnLexique } from "@akufen/ckeditor5-akfn-lexique";
I am not sure if I am loading the custom plugin wrong or if maybe we could have a validation on your side like in craftcms/ckeditor/src/helpers/CkeditorConfig.php the registerPackage function could use a array_unique after the array_merge.
Additional info
- Craft version: 5.9.15
- PHP version: 8.4.17
- Plugins & versions: 5.1.0