Color setting lost

Created on 22 May 2024, about 1 month ago
Updated 23 May 2024, about 1 month ago

Problem/Motivation

In the font color plugin, you select a color from the widget, it shows in the editor, but when saved the style attribute is stripped out.
In editor - view source

<p>
    <span style="color:hsl(120, 75%, 60%);"><span>green colour text</span></span>
</p>

Viewing
<p><span><span>green colour text</span></span></p>

Steps to reproduce

enable plugin
add to tool bar in full_html text format
add text and apply color widget
save
color attribute has disappeared

Proposed resolution

stop stripping attribute

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom Jons

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

Comments & Activities

  • Issue created by @Jons
  • πŸ‡΅πŸ‡±Poland dolszewski

    Hello @jons
    Do you have enabled "Limit allowed HTML tags and correct faulty HTML" filter in your full_html text format? I assume that could be the reason why attributes are stripped out.

  • πŸ‡¬πŸ‡§United Kingdom Jons

    Hi @dolszewski
    Yes disabling this stops the stripping - but should there be a config to allow span to have an attribute?
    With a custom tag this is possible. Would it make sense to use a custom tag?

  • πŸ‡΅πŸ‡±Poland salmonek

    Hi @jons
    As far as I remrmber the CKeditor 5 plugin works on span itself, so that would need to rewrite the plugin itself.
    There is a workaround though. Highlight plugin works in a similar way, but uses classes and mark elements. Please try it - maybe it'll suit your needs. Please be aware that you'll need to add the styling to your theme manually, reuired code is availabe in the config form.
    https://www.drupal.org/docs/extending-drupal/contributed-modules/contrib... β†’

Production build 0.69.0 2024