-
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
Rich text: add button to clear unknown format #44086
Conversation
Size Change: +287 B (0%) Total Size: 1.32 MB
ℹ️ View Unchanged
|
It looks like this may also fix #43680. |
Should this show up in the visible tools (not the show more dropdown) when the cursor is within an unknown format? |
@mtias Sure, if you like. |
Yeah, but this one seems like you might want to know if there's something odd |
6dc3744
to
4e7a25f
Compare
4e7a25f
to
5eda786
Compare
5eda786
to
21274d5
Compare
Let's ship the feature, we can always iterate on it. Code is isolated to rich text and added an e2e test. |
I was investigating #46777 related to this PR. It appears that this PR no longer allows format types s that don't have Is there any way to address this issue? |
return className === null && bareElementTagName === tagName; | ||
} ) || | ||
formatTypes.find( ( { className, tagName } ) => { | ||
return className === null && '*' === tagName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line ensures that core/unknown
is detected.
Therefore, it appears that format types that don't have className
cannot be newly registered, even if the tagName
has not yet been registered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed by #46798
What?
Partly addresses #8869.
Fixes #43680.
Adds a button to remove the selected unknown formatting.
This resolves one use case for a "clear formatting" button. Note that this button will only appear when an unknown format is selected.
To select all unknown formatting, select all the text.
Maybe there's also a use case for a button to remove ALL formatting (known and unknown), but this should be done separately. We need some good heuristic for what should be removed. Should inline image be removed? Should links?
Why?
Currently there's no way to remove unknown formatting in the visual editor.
How?
Adds a catch-all format type.
Testing Instructions
Edit a paragraph with the HTML editor and wrap some text in (for example) a cite tag.
Go to the visual editor and select the formatted text.
The button to clear the unknown format should be active.
Click it to remove the formatting.
Screenshots or screencast