Skip to content
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

Closed
2 tasks done
alcurrie opened this issue Oct 30, 2018 · 13 comments
Closed
2 tasks done
Labels
Enhancement New feature or improvement of an existing one
Milestone

Comments

@alcurrie
Copy link

alcurrie commented Oct 30, 2018

As a AMP story author, I don’t want be able to create blocks outside of the current page

  • AC 1: Ensure that it is not possible to create blocks created outside of page: https://v.usetapes.com/IYEIsJFz2E.
    • AC 2: It should be clear that top inserter is used for creating new blocks only in the current page/layer
@alcurrie
Copy link
Author

@jwold - I think this was originally your screen cast. I'm not 100% on what the issue/recommendation here is?

@jwold
Copy link
Collaborator

jwold commented Oct 30, 2018

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.

@miina
Copy link
Contributor

miina commented Oct 30, 2018

@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.

@alcurrie alcurrie added UX and removed UX labels Nov 1, 2018
@miina miina added the BE label Nov 1, 2018
@miina miina self-assigned this Nov 8, 2018
@miina miina removed their assignment Nov 12, 2018
@miina
Copy link
Contributor

miina commented Nov 12, 2018

Update:
Checked that at this moment it's still not possible to do this within Gutenberg via code.

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 (li element) does not -- even if we'd hide the inner icon then an empty li element would still be there.

@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:
screen shot 2018-11-12 at 11 07 14 am

If the inserter is for the root level and then hide all the other selectors except for Page block:
screen shot 2018-11-12 at 11 06 32 am

@mehigh
Copy link
Contributor

mehigh commented Nov 15, 2018

@miina / @alcurrie
Please review this video I made here: https://dsh.re/a0287
It shows what I was able to achieve with this PR: #1616

@alcurrie
Copy link
Author

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
Would you mind taking a look at the interface changes and confirming that you think what you are proposing/describing would work with the updated interface?

@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?

@mehigh
Copy link
Contributor

mehigh commented Nov 19, 2018

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.
It's not ideal, not final. It only improves on the out of the box, but not by enough.

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

@mehigh
Copy link
Contributor

mehigh commented Nov 19, 2018

"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.

@miina
Copy link
Contributor

miina commented Nov 19, 2018

@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.

@miina
Copy link
Contributor

miina commented Nov 19, 2018

@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?

@miina
Copy link
Contributor

miina commented Nov 22, 2018

@alcurrie: Update, it seems to be possible now without CSS; so I'll be resolving this together with #1559.

@mehigh
Copy link
Contributor

mehigh commented Nov 22, 2018

Lovely solution, Miina.
Closing as merged. Passing on to QA.

@mehigh mehigh closed this as completed Nov 22, 2018
@mehigh mehigh assigned alcurrie and unassigned mehigh and miina Nov 22, 2018
@alcurrie
Copy link
Author

alcurrie commented Dec 2, 2018

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:
https://cl.ly/063d83576ff3

@alcurrie alcurrie removed their assignment Dec 2, 2018
@westonruter westonruter added this to the v1.2 milestone May 21, 2019
@swissspidy swissspidy added Enhancement New feature or improvement of an existing one and removed AMP-Stories-Extension labels Jun 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or improvement of an existing one
Projects
None yet
Development

No branches or pull requests

6 participants