collective / volto-hydra

A volto addon to let you edit content in realtime when you have many frontends written in any framework
0 stars 2 forks source link

I can add a page and be editing it in the preview #11

Closed djay closed 2 months ago

djay commented 3 months ago

plone currently allows for editing before creation.

Instead

This is mockup for adding a folder but maybe we do page the same way?

Image

Image

djay commented 2 months ago

As discussed

MAX-786 commented 2 months ago

OR: change the add page to always display the form view on add

  • Then you enter a title and shortname and click save. Save will then redirect you the full edit page
  • should be easy to do. just change the condition so it appears even if blocks enabled, but only on add view, not edit
  • pros

    • you can to pick a title before any transaction happens and never left with bad url
  • cons

    • not like plone now. you get an extra screen

I looked into this approach and one way was to have Custom Form whenever user go to '/add' endpoint.

But after looking into volto core I found that this visual prop is passed by Edit and Add views to tell the Form whether to show the Sidebar and Blocks or not.

So, I just changed this visual prop in Add view to be false always since we are not rendering Blocks and so now Add view shows the Form like it does when adding a File where you can give this page a title and summary and once you click save it will redirect you to that page/edit and you can further edit it. Also cancel works as usual.

Till now it doesn't seems to break anything. so lemme hear what you guys say about this :).

You can look at the code and Demo video in the PR

djay commented 2 months ago

If possible it would be good to redirect directly to edit mode so it's closer to what plone normally does

MAX-786 commented 2 months ago

If possible it would be good to redirect directly to edit mode so it's closer to what plone normally does

Check the latest commit, it now redirect user to the edit view of newly created page.