Repository navigation
Conversation
|
Size Change: +391 B (0%) Total Size: 825 kB
ℹ️ View Unchanged
|
If the block stays registered, someone might try to use it later in the post where it's allowed, but without installing the source plugin, which would cause issues when saving the post.
Contributor
|
This is definitely tricky since I think it's quite possible that a user has selected a block (maybe accidentally) that doesn't allow insert but still want to add a block that matches their search. Assuming that's possible, I think the copy should mention the block that it's trying to insert into. IE: |
Contributor
Author
Contributor
|
Great! I'm good with the code as it pertains to the Block Directory Package. I'm not too familiar with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


Description
Some blocks (or post types) have a restricted list of what can be added (
allowedBlocks), and we might not be able to add a new block to those containers. Before trying to add & install the plugin, this checks if the block is allowed.I tried filtering through
downloadableItems, so we could only show allowed blocks, but unfortunatelycanInsertBlockTypeneeds the block to be registered first. So instead, we'll show an error and abort the install process.How to test
I made a quick plugin that restricted blocks for all content, and when I tried to search for & add a block, I get the error.
You can add a block from the block directory to that array (ex,
card-block/main), and then try to use it, and it should work. It should also still work for unrestricted editors.Screenshots
The error (copy could be improved for sure 🙂 )