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

Rich Text: allow underscores in Format Type class name format #56571

Closed
alexandrebuffet opened this issue Nov 27, 2023 · 0 comments · Fixed by #56599
Closed

Rich Text: allow underscores in Format Type class name format #56571

alexandrebuffet opened this issue Nov 27, 2023 · 0 comments · Fixed by #56599
Assignees
Labels
Good First Issue An issue that's suitable for someone looking to contribute for the first time [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@alexandrebuffet
Copy link
Contributor

When we want to register a format type with a class that contains one or more underscore characters "_", we get the error message A class name must begin with a letter, followed by any number of hyphens, letters, or numbers. in the editor and the format is not registered.

For example, the error is triggered if I declare a "Counter Number" format type only available in a "Counter" block and want this format to apply a with the counter__number class name (I want to respect BEM naming convention inside the block) on the selection.

I've noticed that the corresponding regex in registerFormatType which checks the classname format, introduced in #10209 by @ellatrix, doesn't include the character.

This character is allowed in CSS selectors and is present in the regex of the sanitize_html_class formatting function if I'm not mistaken.

Could we concider adding the character in the regular expression to authorize this character in Format Type class names?

@alexandrebuffet alexandrebuffet added the [Type] Enhancement A suggestion for improvement. label Nov 27, 2023
@talldan talldan added the Good First Issue An issue that's suitable for someone looking to contribute for the first time label Nov 28, 2023
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue An issue that's suitable for someone looking to contribute for the first time [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
None yet
2 participants