CKEditor 5 accumulates class properties when switch code language in Code Block

Created on 30 November 2023, 12 months ago

Problem/Motivation

The Code Block function of CKEditor 5 does not delete the class attributes of the previous code language when you select a different code language. This means that the old class attributes are accumulated and not deleted when you change the code language.

This behavior can be a problem because when you change the code language, you would expect the class attributes of the new code language to replace the old ones and no stacking would occur. Most of module which are provide syntax based highlight feature use these class properties of the code tags to decide how to color the code.
Because of this, the highlightjs_imput_filter module becomes unusable, but the codesnippet doesn't have a CKEditor5 version, so code highlighting is currently problematic.

Steps to reproduce

1. Enable drupal/ckeditor5 module.
2. Select Code Block on CKEditor 5 editor bar, write your code.
3. Select the appropriate code language.
4. If you want to change it and select another code language, the previous one will not be removed from the class of the code tag..

🐛 Bug report
Status

Active

Version

10.1

Component
CKEditor 5 

Last updated 2 days ago

Created by

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