-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
RichText: add withoutInteractiveFormatting prop #14542
Conversation
1986755
to
f959e91
Compare
This comment has been minimized.
This comment has been minimized.
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.
Flipping this API makes total sense to me! 👍
I think we need to make the new prop more backwards compatible. Other than that, this is great.
f959e91
to
e674f20
Compare
I'm not sure if there's a way to make it fully backwards compatible.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@chrisvanpatten Sure, it makes sense to allow it if you know what you're doing. I'll add something like |
@ellatrix you da best! That would be amaaaaazing. Thank you!!! |
@chrisvanpatten @epiqueras I added a |
We will also need this PR for footnotes. The footnotes format will be disabled in instances that enabled |
@mcsf Might be useful for you title block. :) |
Got here through the "Good First Review" label and thought it was added by accident or a long time ago, given the size of this PR. My bad, I put it back :) |
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.
Looks great, and I like this API! 👍
We ought to add a note to block-editor/CHANGELOG.md
which describes this change.
While testing this I noticed a bug where, in the Search block, if you move focus from the label field to the placeholder field, the formatting controls don't go away. This bug exists on master
, though, so not a blocker.
|
||
if ( formattingControls ) { | ||
deprecated( 'wp.blockEditor.RichText formattingControls prop', { | ||
version: 'the future', |
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.
Unless there's a specific version that we're planning to remove this, I think it's best to omit the version
option.
version: 'the future', |
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.
I did what the docs recommended:
gutenberg/packages/deprecated/src/index.js
Lines 29 to 34 in f7d90b9
* deprecated( 'Eating meat', { | |
* version: 'the future', | |
* alternative: 'vegetables', | |
* plugin: 'the earth', | |
* hint: 'You may find it beneficial to transition gradually.', | |
* } ); |
return; | ||
} | ||
|
||
if ( formattingControls ) { |
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 if
isn't necessary if we move the deprecated()
call to be after the if ( allowedFormats ) { ... }
below.
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.
What if you use both?
That only happens when switching between a |
05791a9
to
d959422
Compare
Does this fix #12439 too? |
@ktmn I'd recommend either commenting on an existing open issue that is on the same topic or creating a new issue (if there isn't one already). It's really easy to miss comments on already merged PRs. |
Description
Fixes #15212 (comment).
Fixes #14528.
Fixes #15858.
Adds a
withoutInteractiveFormatting
prop toRichText
. We currently have a use case where we'd like to remove the link button (and any other interactive elements) from blocks such as button, file, and search, as it would create invalid HTML.Also deprecates
formattingControls
and introducesallowedFormats
(similar toallowedBlocks
). Example:[ 'core/bold' ]
.How has this been tested?
Screenshots
Types of changes
Checklist: