Skip to content

Track active CKEditor 5 instance #6770

@quicksketch

Description

@quicksketch

Description of the need

Previous WYSIWYG systems (like the D7 WYSIWYG module) tracked the last active editor with Drupal.wysiwyg.activeId. And tinyMCE tracks the current editor with tinyMCE.activeEditor.

CKEditor does not provide this ability, and accomplishing it in CKEditor 5 is particularly tricky, see this StackOverflow post on getting active instances.

Some contrib modules like Insert would like the ability to insert into CKEditor 5 instances. Since this is difficult to add from outside of core, it would be preferable if core could provide this mechanism for use by contrib.

Proposed solution

Backdrop core's ckeditor5.js file should track the active instance in Backdrop.ckeditor5.activeEditor.

Alternatives that have been considered

The Insert module is trying to do this and sort of achieves it by using a window.timeout(), but it's not 100% reliable. It would be better to use the .then() promise after an instance is created.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions