Unable to register format type to handle bare tag name #46795
Labels
[Feature] Rich Text
Related to the Rich Text component that allows developers to render a contenteditable
[Status] Duplicate
Used to indicate that a current issue matches an existing one and can be closed
[Type] Bug
An existing feature does not function as intended
Description
Users are unable to register a new format type to handle a bare tag name (i.e. when
className
is set tonull
), asregisterFormatType
logs the following error:This occurs because
registerFormatType
has the following validation snippet in line 80:that checks if the given
tagName
is already registered. The current implementation ofgetFormatTypeForBareElement
:always returns a valid format type for any bare element, because of the second part of the
return
statement, thus making it impossible to register new formats.Possible Solution
In
registerFormatType
, change line 85 from:to
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: