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

Change data-list attribute to ql-list-item classes #4490

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

guylan-dieu
Copy link

Sanitizers remove the data attributes from HTML to prevent XSS vulnerabilities.
I have noticed Angular sanitizer is removing data attributes, as others can do as well (https://github.com/jitbit/HtmlSanitizer).

The problem is that by losing data attributes, we are also losing the corresponding style.

The only data attributes used in Quill are for list items <li> :

  • [data-list]=""
  • [data-list]="checked"
  • [data-list]="unchecked"
  • [data-list]="bullet"
  • [data-list]="ordered"

Since class attribute is not sanitized, I propose to replace thedata-list attribute with equivalent CSS classes :

  • .ql-list-item
  • .ql-list-item-checked
  • .ql-list-item-unchecked
  • .ql-list-item-bullet
  • .ql-list-item-ordered

It give the advantage to keep the list items information after sanitizing HTML content (that is a common requirement for rich text editor that produce HTML to show publicly). It also standardizes Quill format management while the list format was the only one depending on data attributes instead of CSS classes.

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

Successfully merging this pull request may close these issues.

1 participant