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

Add an option to change default renderingMode of Post Editor #58038

Open
fabiankaegy opened this issue Jan 20, 2024 · 11 comments · May be fixed by #62304
Open

Add an option to change default renderingMode of Post Editor #58038

fabiankaegy opened this issue Jan 20, 2024 · 11 comments · May be fixed by #62304
Labels
[Package] Editor /packages/editor [Type] Enhancement A suggestion for improvement.

Comments

@fabiankaegy
Copy link
Member

In #56817 the ability to preview the template of a post right in the Post Editor. This is a really nice update that is a huge win for making the editor look like the frontend.

Ideally, I would love to be able to have this turned on by default. Either as a user setting, or even a global option that could be applied via a filter somewhere.

Another option would be for the setting to simply get remembered so that when you enable the template-locked rendereing mode and for example reload the editor the setting gets remembered. Kind of like the code editor vs. visual editor setting gets remembered.

@fabiankaegy
Copy link
Member Author

@youknowriad just mentioned in the tracking issue how it might be a good idea to have this available as a config options for any custom post types:

#52632 (comment)

@youknowriad
Copy link
Contributor

My current thinking is that:

  • Post and site editors should have the same default behavior, which is not currently the case for "pages".
  • maybe this could be a flag for register_post_type function call.
  • I don't see a UI as necessary at the moment, I feel the UI could be plugin territory to start with.

@fabiankaegy
Copy link
Member Author

@youknowriad how do you feel about keeping the selection of the current rendering mode in the user settings so that it retains the state on reload?

@fabiankaegy
Copy link
Member Author

I also just noticed, if you don't have multiple templates, the template picker also doesn't show in the editor and therefore users are not able to select the "Show Preview" option 🤔 Not sure that is related to #58037 or an unrelated additional issue

@youknowriad
Copy link
Contributor

youknowriad commented Jan 22, 2024

how do you feel about keeping the selection of the current rendering mode in the user settings so that it retains the state on reload?

That is a design decision in general and I tend to have few design options. On this one I personally tend to this not being a user preference thing but a CPT thing:

  • It makes sense to have pages by default showing templates
  • It doesn't make sense to have "posts" by default showing templates...

I also just noticed, if you don't have multiple templates, the template picker also doesn't show in the editor and therefore users are not able to select the "Show Preview" option 🤔 Not sure that is related to #58037 or an unrelated additional issue

I didn't know but it would be cool to get these bugs fixed for 6.5

@fabiankaegy
Copy link
Member Author

@youknowriad

It doesn't make sense to have "posts" by default showing templates...

I can see how this may be a good default for Core. But on every single site I've worked on in the last 4 years I would have wished to have the template showing also for posts. Because of the simple reason that many posts pages have complex headers these days with Featured Images, Metadata, The title, all in different order / sometimes even overlaid. And therefore it matters greatly to be able to see a preview of that.

So I would always want to turn this on even for the default posts CPT.


Regarding the bugs. Yeah I agree. It has been added to the 6.5 board as a TODO.

I don't currently feel confident in my ability to fix it though. Do you have any capacity to look into it?

@fabiankaegy
Copy link
Member Author

@richtabor @jasmussen @jameskoster would love to get your thoughts on the template preview and how it should be tied to post types / user settings / retain it's selected option when reloading etc :)

Thanks in advance 🙏

@youknowriad
Copy link
Contributor

I don't currently feel confident in my ability to fix it though. Do you have any capacity to look into it?

Not in this time sensitive moment, but maybe later if no one beats me to it.

@jasmussen
Copy link
Contributor

Just to be sure I'm capturing this right, what you would like is for this option to persist across reloads? This:

template preview

If yes, then I don't know that I'd necessarily be opposed to that option persisting across a reload. But to be honest I'm also not entirely sure it's a good idea quite yet. Mainly, there are some writing-flow tradeoffs currently present, like the ability to type a title and press Enter to go right to writing. This is not possible in the site editor view.

I agree with the vision that fundamentally the editors are the same, and should be thought of as one. But just like we have a with-or-without template preview mode, I personally think of the site editor itself as a view mode — the site editor is a the with-template view mode. But there are still somewhat disparate entry-points for these modes, where you can add new pages in two places, posts in another. How these are navigated between, so you can intuitively float between these in a natural way, I have a feeling we might want to make a bit more progress on that, before we optimize too heavily for these as separate editors.

There's namely the nuance that even though this is one editor, there are still various flows we need to capture. Sometimes I just want to write a post, and I don't want to see the site editor stuff, locked or not. That still needs to be captured.

@jameskoster
Copy link
Contributor

To me it seems reasonable that post types can specify a default for this setting. Posts are an example where you'd likely want the template preview toggled off because they can appear in different contexts (single / archive). Pages are the opposite.

I agree with Joen that there are gaps in the writing experience when the template is hidden. I'd also add; if we want to keep the title on the canvas then it might make sense to include other visual details like the featured image – basically all the elements listed in the "Content" panel in the Inspector.

If we consider the old post editor experience as 'writing mode' then I see considerable overlap between that and the template preview setting. IE when the template is hidden you're in 'writing mode'. From that perspective the setting may need to be reframe a little, and repositioned in the UI. Seems worth a quick design exploration to me.

@dinhtungdu
Copy link
Contributor

Posts are an example where you'd likely want the template preview toggled off because they can appear in different contexts (single / archive). Pages are the opposite.

I agree, pages can have complex templates, and with Custom Fields and Block Bindings in the future, live editing complex pages in template-lock mode is an awesome experience for me. Maybe we can also let the template decide the default mode pages using it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Editor /packages/editor [Type] Enhancement A suggestion for improvement.
Projects
No open projects
Status: 🏈 Punted to 6.7
5 participants