Skip to content

CKEditor 5: packages cannot register custom editor plugins #5896

Description

@Lucsaan

Environment

  • OTOBO 11.0.15 / current rel-11_1
  • CKEditor 5 (47.6.1 bundled)

Problem

Since the CKEditor 5 migration there is no way for OTOBO packages (add-ons) to provide their own CKEditor plugins.

In rel-11_1 the active plugin list is nicely configurable via Frontend::CKEditorPlugins — thank you for that! However, Core.UI.RichTextEditor.js resolves each configured name against the CKEditor5Wrapper ES module namespace only:

for (let pluginName of PluginList) {
    let Plugin = CKEditor5Wrapper[pluginName];
    ...
}

ES module namespace objects are not extensible, so a package cannot register anything there. Adding a custom plugin name to Frontend::CKEditorPlugins can only ever produce Couldn't find plugin — the mechanism is limited to plugins compiled into the CKEditor bundle.

(In rel-11_0 there was a plain-object registry window.CKEditor5Plugins built in Core.UI.CKEditor5Wrapper.js, which packages could extend. That registry is gone in rel-11_1.)

Use case

We are porting CKEditor 4 era behavior that customers rely on, implemented as small CKEditor 5 plugins shipped by a package, e.g.:

  • a clipboard normalizer that restores Excel cell background colors on paste (see the companion issue about paste from Excel),
  • an image border toggle button (CKEditor 4 had a border field in the image dialog; CKEditor 5 has none).

Both work fine as CKEditor 5 plugin classes written against the exposed window.CKEditor5Wrapper namespace — the only missing piece is an official way to register them.

Proposal

Resolve plugin names against a mutable registry as fallback:

let CustomPlugins = window.CKEditor5CustomPlugins || {};
let Plugin = CKEditor5Wrapper[pluginName] || CustomPlugins[pluginName];

A package then ships a loader JS file that registers its class in window.CKEditor5CustomPlugins and adds the plugin name to Frontend::CKEditorPlugins via SysConfig. No core behavior changes for standard installations.

A pull request implementing this is ready and will be linked here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions