[RNMobile] Add support for "multiple": false block types#28339
[RNMobile] Add support for "multiple": false block types#28339cameronvoell merged 4 commits intoWordPress:masterfrom
"multiple": false block types#28339Conversation
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! |
cameronvoell
left a comment
There was a problem hiding this comment.
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.jsonfile: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
.disabledstyle for theinserter-buttoncomponentitem.isDisabledvalue to the UI (this value already existed)Checklist: