-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
unregisterFormatType at the Block/Component level #16246
Comments
Hey @AlchemyUnited Thank you for creating the issue! |
@paaljoachim it is for me, absolutely. |
@ptbello - Agreed. Without support for design systems, Gutenburg will never fulfill its destiny. The underlying technology is great. Unfortunately, it often feels out of touch with real-world use. @paaljoachim - To answer your question, I have no idea if this is still valid. I don't think I've gone back to it since opening the ticket. Sorry. |
Well one good place it bring attention to this issue is during a Wednesday Core Editor chat. |
Underline is usable as a keyboard shortcut, but not a visible format. This is because underline and justify was removed in WP 4.7 see https://core.trac.wordpress.org/ticket/27159. I personally don't agree, but the project reasons noted the following for why: " It introduces a potentially bad user experience issue: readers confusing the underline text with a link. Underlined text is broadly interpreted as web links." If you'd like a visible underline button, it should be possible to register a new format type. See https://developer.wordpress.org/block-editor/tutorials/format-api/ @AlchemyUnited did you have any luck with
We can maybe split this one out into its own issue to see what folks think. Copy suggestions are welcome ✨ |
Is your feature request related to a problem? Please describe.
Ultimately, I want to limit "user error"/"human error" as much as possible. So, for example, RichText formats types of 'code' or 'inline image' for a heading aren't appropriate. They are however suitable for say paragraph. Counting on telling a user not to do X or Y is ultimately a UX destine for doom :)
Unless, I'm doing it all wrong, unregisterFormatType dose let me remove formats. Great. The bad news is, those are global, and can not be applied selectively. That is, there's no way (I've found, so it could be me) to do unregisterFormatType at the block / RT component level.
https://github.com/WordPress/gutenberg/blob/master/packages/rich-text/src/unregister-format-type.js
Describe the solution you'd like
Ultimately, maybe what would be best would be to make RichText's formattingControls=[] more robust. At the moment, it's limited to bold, italic, and link. [1] And there's no way (that's I've found) via the RT component's props to do anything about the items in the More menu.
Describe alternatives you've considered
I did try using formattingControls and unregisterFormatType together. That is, remove bold with unregisterFormatType and then selectively add it back with formattingControls . No go. Didn't work for me. But, again, perhaps there's a way to do this that's unpublished and/or I just haven't found it yet.
Also
[1] The README / docs also lists strikethrough as valid with RT's formattingControls but strikethrough isn't effected. It should be removed from the doc (or there's a bug).
[2] When I dumped the format types
This is what I got:
What I find odd is that core/underline can't be added / influenced with formattingControls, but it also doesn't show up in the "More Rich Text Controls" menu either. So core/underline is registered yet never shows up. Is that right? Or a bug?
p.s. It would also be super nice if we could control the "More Rich Text Controls" tool tip message. That is, instead of "More Rich Text Controls" it would be a more focused and sensible UX to say "More Heading Controls" or "More Heading Settings". A plain Joe / plain Jane user has not idea what Rich Text is, nor should they. Proper language, while subtle, would improve the UX.
The text was updated successfully, but these errors were encountered: