Rich Text: allow underscores in Format Type class name format #56571
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.
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?
The text was updated successfully, but these errors were encountered: