Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x]: Default HTML Purifier removes some list-styles from <ol> #136

Closed
Denham opened this issue Sep 8, 2023 · 2 comments
Closed

[4.x]: Default HTML Purifier removes some list-styles from <ol> #136

Denham opened this issue Sep 8, 2023 · 2 comments
Assignees
Labels

Comments

@Denham
Copy link

Denham commented Sep 8, 2023

What happened?

Description

Any editor using the default HTML purifier setup will not save a.b.c. list styles.

Specifically - when formatting an ordered/numbered list in ckeditor or redactor, and changing the numbered list-style to using latin characters (the a.b.c. option) the styles are removed when the entry is saved. It does not remove the number/roman (eg. i.ii.iii.iv.) styles though.

(Apologies if this is report is meant to go elsewhere)

Steps to reproduce

  1. Start with any installation of craft (tested on fresh install, and existing client sites)
  2. Have a ckeditor field with a config that includes the Numbered List toolbar item
  3. Edit an entry with that ckeditor field
  4. Make a numbered list, change the list style to a.b.c.
  5. Save the entry
  6. View / edit entry to see list changed back to 1.2.3.

Additional info

  • Craft version: 4.5.3
  • PHP version: 8.2.10
  • Database driver & version: MySQL 8.0.32
  • Plugins & versions: ckeditor 3.5.1

I can replicate the issue on older versions of Craft 4 / ckeditor 3 / Redactor 3.

Craft CMS version

4.5.3

PHP version

8.2.10

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

  • ckeditor 3.5.1
@Denham Denham added the bug label Sep 8, 2023
@i-just i-just self-assigned this Sep 11, 2023
@brandonkelly brandonkelly transferred this issue from craftcms/cms Sep 11, 2023
@i-just
Copy link
Contributor

i-just commented Sep 11, 2023

Hi, thanks for reporting! I raised a PR for this.

The Redactor plugin is sort of on life support now, but if needed, you can achieve the same behaviour via EVENT_MODIFY_PURIFIER_CONFIG; for example:

Event::on(
    \craft\redactor\Field::class,
    \craft\redactor\Field::EVENT_MODIFY_PURIFIER_CONFIG,
    function (ModifyPurifierConfigEvent $event) {
        if ($event->config) {
            $def = $event->config->getDefinition('HTML', true);
            $def?->addAttribute('ol', 'style', 'Text');
            $def?->addAttribute('ul', 'style', 'Text');
        }
    }
);

@brandonkelly
Copy link
Member

CKEditor 3.6.0 is out with a fix for this via #137.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants