WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.25k stars 4.09k forks source link

Site editor: add support for more deep links for the Site Editor #57312

Open annezazu opened 8 months ago

annezazu commented 8 months ago

What problem does this address?

I'm working with @adamziel to setup a WordPress Playground instance where I can spin up specific live previews of features that folks can then explore. In doing so, I am running into limitations not due to playground itself but because of limitations with URL params and the lack of deep linking in the Site Editor. For example, I’d love to be able to send someone a live preview of styles open with style book turned on but there isn't support for deep links for this kind of functionality. From what Adam has indicated, creating a feature plugin for this would be difficult because some of these UI states are internal to React components and contexts.

In general, this could also be useful for situations like exposing the Styles UI for classic themes as described here: https://github.com/WordPress/gutenberg/issues/41119#issuecomment-1381633892 and likely for broader support documentation.

What is your proposed solution?

Add support for deep links to various interfaces including:

I don't know the reasoning for the lack of this support right now so am also generally curious there. Those are the items off the top of my head but kicking this off so I can add to it as I continue to experiment with WP Playground.

annezazu commented 8 months ago

For even more context, here's a post where I'd love to include a live preview link for folks to immediately see a feature/tool in action from the /News post: https://github.com/WordPress/Marketing-Team/issues/335 It would be hugely helpful and a game changer to allow for that for features like the style book and command palette.

adamziel commented 8 months ago

Cc @youknowriad @scruffian @talldan

talldan commented 8 months ago

The styles are accessible through wp-admin/site-editor.php?path=%2Fwp_global_styles, but I'm guessing the request is for the global styles sidebar in edit mode.

There previously was a deep link to that. I had #38172 open for a very long time with no resolution, and it ended up being resolved differently 😄 See also #49585.

I do wonder whether opening sidebars and modals using a route or query param is good practice. Would it work ok with the back button? History is linear and one dimensional, but sidebars are multi-dimensional since you can have a combination of them open or closed, so I guess the best thing would be for this to not affect the browser history.

Maybe an option is to have a url like http://localhost:8888/wp-admin/site-editor.php?canvas=edit&sidebar=styles, when navigated to the page processes the opening of the sidebar and then immediately replaces the path to remove the sidebar param. Thinking of a good url schema for different parts of the UI becomes pretty complicated.

carolinan commented 7 months ago

I need this too for the same reason :)