craftcms / craftcms/ckeditor

[5.x]: Unable to load CKEditor plugins due to asset bundle namespace

Open
#592 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
47
Forks
32
PR merge metrics
No merged PRs in 30d

Description

Description

When trying to register an asset bundle extending craft\ckeditor\web\assets\BaseCkeditorPackageAsset, sometimes the bundle isn't properly loaded within craft\ckeditor\web\assets\BaseCkeditorPackageAsset::$ckeditorPackages. When trying to register an identical asset bundle where the only change is the namespace, the package is registered properly. The package is also successfully registered if the body of the craft\ckeditor\Plugin::init() method is placed within the Craft::$app->onInit() callback.

Steps to reproduce
  1. Generate a Craft plugin
  2. Register a BaseCkeditorPackageAsset asset bundle with Ckeditor with varying root namespace.
Additional info

The packages should end up being registered depending on the namespace of the PHP package. While debugging, the plugins with namespace beginning in A/B/C would work, while the Plugins with namespaces beginning in D/E/F/... wouldn't work.

Local modules would always work.
Yii2 Extensions (modules) would always work.

  • Craft version: 5.10.3
  • PHP version: 8.2
  • Database driver & version: MySQL 8.0.40
  • Plugins & versions:
    • CKEditor 5.6.1
    • CKE Shy 2.0.2
    • Code Field 5.0.2
    • Elements Panel 3.0.1
    • Navigation 3.0.22
    • Neo 5.5.8
    • SEOmatic 5.1.21
    • Table Maker 5.0.9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with craft\ckeditor\web\assets\BaseCkeditorPackageAsset::$ckeditorPackages and the body of craft\ckeditor\Plugin::init(). Reproduce the issue by registering BaseCkeditorPackageAsset bundles with different root namespaces, comparing plugin and module behavior. Done means packages are registered consistently regardless of namespace, without moving initialization into the Craft::$app->onInit() callback.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.