-
Notifications
You must be signed in to change notification settings - Fork 20
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
Feature: remove blocks by page template #957
base: main
Are you sure you want to change the base?
Conversation
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 looks good and will be great to have. I just have one question and maybe I am missing it in the JS...
What would happen if you were to enter a block then change the template when that original block was one listed in the block_page_template_filter
for the new template selected?
Thanks for pointing this out, I had a note in the PR that it didn't do anything once the block is there, but it actually crashes Gutenberg if you switch templates if a filtered block is on the page. Any suggestions on how we should best handle this for a user experience perspective? I think finding a way to warn them that they'll lose their blocks or something like that if they try to switch templates after they have filtered blocks on the page might be decent, allowing them to cancel that action. |
I think a warning message with a cancel/continue option would be great. Then remove the block from the content if they continue. |
We are going to update this in our project first, @ScottGarrison is going to have a look :) |
What does this do/fix?
QA
Using this as a test example in the definer:
Default template, Content Loop is not available:
Change to the Example React App Template and the block becomes available in real time:
Note: Once the block is on there, this doesn't handle removing it or antyhing.
Tests
Does this have tests?