-
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
[RNMobile] Add support for "multiple": false
block types
#28339
Conversation
If the `block.json` configuration for a block specifies `"multiple":false`, then only a single instance of that block should be allowed in a post. If the block already exists in the post, the option to add that block again will be disabled.
"multiple": false
block types"multiple": false
block types
pinging @iamthomasbishop to approve of design for disabled option. |
@AmandaRiu This looks nice from a visual design perspective, but I have one suggestion regarding that interaction. I think we may want to show a feedback component like a Snackbar or Compact Notice when the user tries to tap the disabled button, so there is some sort of feedback/indication as to what happened. If we were to use a Compact Notice, the messaging could be something along the lines of "Only one Read More block is allowed on a [post/page]."). Would something like that be doable? I think a Compact Notice might be easiest to implement, because that component is all-RN, but I'm open to other ideas. Fwiw, I'm also open to shipping the styling improvement now and iterate on the interaction feedback, so whatever works better. |
Hi @iamthomasbishop! That seems like it should be doable and since there isn't a huge rush on this task I can take a look at it before it gets merged and see what can be done. Thank you for the review! |
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.
Change works great. Nice work @AmandaRiu
Fwiw, I'm also open to shipping the styling improvement now and iterate on the interaction feedback, so whatever works better.
I agree with Thomas that we can ship this improvement and perhaps track interaction feedback as a future improvement (maybe we can create an issue for that).
This fix looks ready to ship
|
Related PR
gutenberg-mobile
: wordpress-mobile/gutenberg-mobile#3042Description
Fixes wordpress-mobile/gutenberg-mobile#1156 by adding logic for handing blocks that should only be used once in a single post. These "single use" blocks (such as the "More" block) have the following properties defined in their
block.json
file:The changes in this PR enforce this configuration by disabling the block option if that block already exists in the post.
How has this been tested?
Screenshots
Types of changes
.disabled
style for theinserter-button
componentitem.isDisabled
value to the UI (this value already existed)Checklist: