Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.59k stars 798 forks source link

Sortable block editor sidebar extensions #16877

Open marekhrabe opened 4 years ago

marekhrabe commented 4 years ago

Is your feature request related to a problem? Please describe.

Jetpack has its sidebar for block editor extensions. We use Slot/Fill mechanism to fill it with content but we have no way to sort them, eg: put new/important feature at the very top.

Describe the solution you'd like

Some way to give each item a priority.

Describe alternatives you've considered

Introduce some sort of prioritization for the entire registerJetpackPlugin, not just the sidebar panel. The order of things in the sidebar is equal to the order in which plugins get registered, which I believe will rely solely on the position of the code in the built source code.

Additional context

It's using: https://developer.wordpress.org/block-editor/components/slot-fill/

Source for the sidebar: https://github.com/Automattic/jetpack/blob/master/extensions/shared/jetpack-plugin-sidebar.js

There is a theoretical capability to sort the fills array before rendering it in jetpack-plugin-sidebar.js but there seems to be no API to tell which fill is which and what their priority is. The array has react elements directly in it and if we read from those, I wonder if that would be too brittle.

jeherve commented 1 year ago

Related issue in Core: https://github.com/WordPress/gutenberg/issues/18064