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

Pattern Creator: Try core editor #719

Draft
wants to merge 6 commits into
base: trunk
Choose a base branch
from
Draft

Conversation

ryelle
Copy link
Contributor

@ryelle ryelle commented Dec 18, 2024

A brief history: When the Pattern Directory was first launched, it needed a way for people to create and submit patterns. The design for the creation UI was very custom, so at the time, it made sense to build a custom editor. Even then, this was complicated and required using private and experimental APIs. As Gutenberg continued to iterate, it became harder to keep up with what changed, especially with no dev dedicated to this.

There are currently 25 issues open for the pattern creator alone, mostly due to the way the creator is initialized and loaded (for example, it’s loading the site’s theme, rather than Twenty Twenty-Three like the previews).

I think the custom pattern creator editor should be removed, and instead, allow users to edit the wporg-pattern post type in the core (post) editor1. The editor’s sidebar can be updated for this post type to include all the same settings, and remove the ones that don’t apply. The openverse modal integration should port over easily since it’s designed to work with core blocks. The submission panel could likely be converted into a pre-publish panel.

This PR starts off by removing the pattern creator plugin2, and moving the code here into the pattern-directory plugin, where there is already code to update the post-type editor UI for moderation. I've moved over the back button, media handling, & pattern details UI.

Still to do:

  • Submission flow (pre-publish panel)
  • On submission:
    • Ensure the validation runs, a changed pattern is flipped to pending
    • Prevent the “upload external image” flow
    • Prevent other entity updates (navigation menus, templates, etc)
  • Replace image flow
    • Can reset and open gallery again
    • Cover block, can’t reset/open.
  • Maybe try to update the “external image” modal when inserting media from sidebar?
  • Add template to enable wide/full widths
  • Need to add locale meta
  • Fix up deprecated PluginDocumentSettingPanel, update controls props, find other deprecated/unstable/experimental components
  • What about moderators who are pattern creators?
    • Currently these are two separate UIs, the post-type editor for moderation and the creator for users
    • In this PR, what you see is based on user role, but a moderator creating a pattern will see moderation tools on the new pattern.
  • Ensure internal categories, keywords are not revealed
  • Fix whatever is going on with the sidebar on sandbox

Screenshots

Currently on my local site this works great, but it's showing more info to my user on a sandbox.

Regular user Moderator view
Current Screen Shot 2024-12-18 at 18 00 16 Screen Shot 2024-12-18 at 18 01 49
PR Screen Shot 2024-12-18 at 17 46 44 Screen Shot 2024-12-18 at 17 46 06

The most awkward wp-admin sidebar, when I switch to a regular user on my sandbox.

Screenshot 2024-12-18 at 5 29 38 PM

Footnotes

  1. This will not use the pattern editor, because these are not “patterns” on the current site. Regular users will not have permissions for anything in the Site Editor UI.

  2. This should actually be reverted, I think we'll want to merge the improvements to the pattern editor to allow for testing, before fully removing the creator.

This forces the Pattern Directory placeholder as the default for all media blocks, which correctly flags which blocks are supported and which are not.
@ryelle ryelle added the [Component] Pattern Creator Anything related to the pattern front end editor or preview label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Component] Pattern Creator Anything related to the pattern front end editor or preview
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

1 participant