Fix: Insert Before and Insert After appear even when default block can't be inserted #15024
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Insert Before and Insert after just insert the default block. After the merge of the inserter restrictions PR if a block cannot be inserted the insert action does nothing.
We had a bug if the default block could not be inserted we still allowed the user to click Insert After and Before while the actions did nothing.
This PR does not render an insert before/after button if the default block cannot be inserted.
How has this been tested?
I disabled the default block using:
I created a new post; I inserted an image; I pressed the button to open the "Elipsis menu" and verified "Insert Before/After" buttons don't appear.
I inserted the block "Allowed Blocks Set" available at https://gist.github.com/jorgefilipecosta/ee7969d72e13e9e8e3ab58efdd1fd03b.
I verified that when I open the ellipsis menu of a block inside "Allowed Blocks Set" the insert before/after buttons don't appear.