-
Notifications
You must be signed in to change notification settings - Fork 384
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
It should not be possible for an AMP story author to create blocks created outside of page #1541
Comments
@jwold - I think this was originally your screen cast. I'm not 100% on what the issue/recommendation here is? |
Howdy! The issue is that when I go to insert a new element, it shouldn't be possible for an element to be inserted into the AMP Story, UNLESS it gets dropped into a new page. The video shows an element getting dropped outside of a page, a little orphan all by itself. We need to change it so that won't happen. This might be a Gutenberg dependency, so I'll let @miina weigh in on that. |
@alcurrie and @jwold: Correct, at this moment it's not possible to limit the blocks in Inserter for the root level. See the open issue for Gutenberg: WordPress/gutenberg#7845. |
Update: Perhaps it would somehow be possible to hide all the other elements from the top Inserter via CSS except for the page. I looked into the source and it looks like the block icons have their block-specific classes in inserter, however, the wrapper ( @mehigh Perhaps you could double check if you can see any way how to hide the elements except for Page in case of the toolbar Inserter and only in case the Inserter is trying to insert into the very root level? It's very likely that it's not possible, however, just in case would be good to check If the inserter is not for the root level, for example it's inserting into Vertical Layer like on the screenshot below then leave the Inserter as it is: If the inserter is for the root level and then hide all the other selectors except for Page block: |
@miina / @alcurrie |
Thanks @mehigh I think based on your video, that what you are able to do seems like it would work for what we are trying to achieve for 1.5, but as your screencast showed some elements that will be changed/no longer appear in the interface, I want to make sure that what you're proposing takes into account the proposed interface changes reflected here: https://cl.ly/fc36d7797fbb @miina can you take a look and weigh in on any questions/issues with what Mike's describing/proposing? And/or could we plan to discuss either A-synch here or if not a blocker for other work at Backlog grooming Tuesday? |
What I've done there only went towards limiting the elements that can be added to the root level. It's a hackish solution as the interface isn't yet as intuitive as one could expect. This doesn't touch on any aspects of the actual interface intended in that screenshot @alcurrie . I've only touched the + tooltip/overlay in this proof of concept. I think it's worth exploring unregistering core block types for the amp stories custom post type - as one can find references of here - WordPress/gutenberg#11723 |
"as your screencast showed some elements that will be changed/no longer appear in the interface" -> when we're talking about the root inserter .. i only showed the "Page" element in there. If you're talking about the other inserters (child inserters) - I haven't touched those at all. |
@mehigh The issue with unregistering core block types is that we still need them -- it's just one Inserter in the root level where we don't need the core blocks -- we do need these within the layers though. One option could be hiding the sections as well -- the Page should theoretically always appear as recently used block since we'll automatically add it when a new AMP Story Post is created. We should test this though, thoughts? @alcurrie The new interface changes shouldn't influence what's displayed in the root level Inserter so Mike's "hacky" solution might work for now. |
@alcurrie Probably we could move this back to In Progress (It was already there but I moved it back to Definition since it seemed to be not possible via Backend solution, looks like there is a way via Frontend). This ticket shouldn't have any influence on any other tickets and the task here should be defined -- to hide the unnecessary blocks from the Root level Block Inserter (all the other blocks except for Page). Thoughts? |
Lovely solution, Miina. |
This is confirmed fixed. If a user does not have a page selected, then the only block element that the user can add is a new page block: |
As a AMP story author, I don’t want be able to create blocks outside of the current page
The text was updated successfully, but these errors were encountered: