Description
What problem does this address?
In #64644 we allowed extending the "preview dropdown" in a simple, fairly restrictive manner:
This is great for gathering feedback from real usage.
Extending the preview menu and canvas allow variety of publishing flows and tools, some examples:
- Social media share previews
- Previewing same content in different formats such as website, email, RSS, printed
- Displaying with different membership or paid access restrictions/without
- Dark mode for websites that implement it while editor stays light mode by default
- Additional display sizes for more exotic targets such as televisions, watches
- eBook previews
- AMP format previews
An example of more complex preview capabilities from Substack done directly in the canvas:
Screen.Recording.2023-07-26.at.12.03.19.mov
Another simpler example from Jetpack Social, opening a modal for previewing:
What is your proposed solution?
- Allow extending pre-defined device sizes list
- Allow extending preview dropdown menu with multi-selection items
- Allow adding multiple sections to preview dropdown menu
- Allow extending the editor canvas
Allow extending pre-defined device sizes list
Extending existing devices list is simplest step, as the API could be purely declarative (size, icon, label) and hook into existing functionality:
Examples might be slideshow presentations, TV screens, watches and other more exotic devices. WP is used to build not just websites.
Allow extending preview dropdown menu with multi-selection items
Selections would work in conjunction with existing device-size selectors, and work well with allowing extending editor canvas:
In above scenario you can preview post as a "free" or "paid" subscriber in various device sizes.
Some concerns come from having multiple plugins extend the menu in their own way, and how the menu should then look like. Do we force each plugin onto their own sub-menu or section? Should selections from one plugin clear selections from others? What are the defaults? How do we allow branding show up?
Allow adding multiple sections to preview dropdown menu
Expanding on above example, one could also introduce multiple devices/platforms that are separate from device sizes, such as "email" and "website":
Allow extending the editor canvas
Extending canvas could be done in multiple ways. We could allow:
- completely replacing canvas with custom preview like custom built editor,
- passing alternative styles like dark/light mode, print/TV/website/email
- passing meta info to existing canvas (like free/paid) user
Allowing replacing the canvas brings up questions like do users expect to always be able edit what they see in the canvas, or can canvas work purely for "previewing" too?
Activity