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

Site Editing: Template block states #27064

Open
1 of 5 tasks
jameskoster opened this issue Nov 18, 2020 · 2 comments
Open
1 of 5 tasks

Site Editing: Template block states #27064

jameskoster opened this issue Nov 18, 2020 · 2 comments
Labels
[Feature] Blocks Overall functionality of blocks [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Discussion For issues that are high-level and not yet ready to implement.

Comments

@jameskoster
Copy link
Contributor

jameskoster commented Nov 18, 2020

Blocks that reference post data are unique in that they need to be aware of various different contexts, and appear in different states on the Canvas depending on what task user is currently undertaking.

Consider the existing "Post Title" block...

State 1

If I am editing a template like single with no content loaded as context, the Post Title block should display a generic placeholder that presents a rough demonstration of what it will look like on the frontend.

As I am editing a template, the contents of the block should not be editable, but I should still be able to manipulate the controls to change the position, the width, the heading tag, etc.

State 2

  • Template editing with content

If I am editing a template and have loaded a post in as context, the contents of the Post Title block should reflect the title of that post. But like state 1, as I am editing a template it should not be possible to edit the contents of the block.

Design work needs to be done to determine if this state is something we actually need. It is seemingly undecided whether content should ever be loaded in to template editing, or whether users should instead switch between template / content editing views.

State 3

  • Editing existing content

If I am editing an item of content (like a post) and the Post Title block appears on the canvas as part of the template, I should be able to directly manipulate the content, but not controls like width etc, as those are attached to the template.

State 4

  • Creating content

When I draft a new post, the Post Title block will appear on the canvas in an empty state. I should probably see an "Enter your post title" or similar placeholder in lieu of actual content. As with state 3 I should not be able to change edit controls as the block is part of the template.

State 5

  • Nested

This final state is probably the most contentious as I am not entirely sure this should even be possible. However, if I am editing a post and insert the Post Title block in to the content, it's likely that I want to reference and link out to another post on my site. I should therefore probably see a "Select a post" interface / placeholder.


I believe each of these states can be applied to all of the existing "Post" blocks (Post Author, Post Date, etc), and probably many of the upcoming template tags as well. So we likely need a system that all of these blocks can utilise.

As a part of this work we should also consider updating the block names and descriptions to accommodate these different situations. The current "Add the title of your post" description of the Post Title block is not appropriate when editing a template. I'm optimistic we can come up with a single description that fits all states, but perhaps this will need to be context aware as well.

Given the current shape of the Site Editing project, I suspect states one and two could be considered the priority.

@jameskoster jameskoster added [Feature] Blocks Overall functionality of blocks [Feature] Full Site Editing [Type] Discussion For issues that are high-level and not yet ready to implement. labels Nov 18, 2020
@skorasaurus
Copy link
Member

Btw, great way of breaking this down; agree all of this.

I think this logic is congruent with what I understand to be the syncing/flow for themes that are exported as HTML files and later synced/reimported into the browser

Like for example in states 1 and 2, if you modify a template file externally (outside of gutenberg) and when the database detects that the template changed, no rows located in wp_posts table where post_type = 'post' OR where post_type = 'page', etc, are modified.

@jameskoster
Copy link
Contributor Author

I'm not sure if they should be discussed in a separate issue, but I suspect that Template Parts will also need some kind of 'context awareness' as well. In short: If I'm editing content, I should not be able to edit a template part contents directly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Discussion For issues that are high-level and not yet ready to implement.
Projects
None yet
Development

No branches or pull requests

3 participants