Implement Token-Click-Insert for CKEditor 5

Created on 19 January 2023, almost 2 years ago
Updated 16 April 2024, 7 months ago

Problem/Motivation

This module provides functioanlity to insert a selected token into the currently active input/textarea/tinyMCE/CKEditor
/CodeMirror. This is handled in Drupal.behaviors.tokenInsert. I woul like to have the same functionality for CKEditor 5.

Steps to reproduce

Enable CKEditor5 for a field and try to insert a token via the click_insert functioanlity of the
token_tree_table render element. Nothing will happen.

Proposed resolution

Since there is no global CKEDITOR.currentInstance variable for CKEditor 5 i propose listening to the change:isFocused event to set a new drupalSettings.tokenFocusedCkeditor5 variable which saves the last active CKEditor5 editor instance.
This variable can then be used when trying to insert a token and no other field is focused.

Data model changes

New global JavaScript variable drupalSettings.tokenFocusedCkeditor5.

✨ Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

🇩🇪Germany tgauges

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024