Skip to content

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