pattern-directory icon indicating copy to clipboard operation
pattern-directory copied to clipboard

Add Pattern Directory support to the core editor

Open tellyworth opened this issue 5 years ago • 3 comments

The core editor should allow users to search and insert block patterns from the pattern directory, in a similar way to the block directory.

Tentative assumptions:

  • Unlike block plugins there is probably no "install" step needed. Patterns from the directory can simply be inserted into a post exactly as core patterns work at present.
  • Core patterns might be moved to the Pattern Directory, so they can be improved independent of the core release schedule.
  • A local REST API endpoint for searching the pattern directory might be needed, in a similar manner to the block directory endpoint. (#3)
  • Patterns from the directory can probably be listed in the same UI as core patterns are at present.

This is an umbrella task, specific issues should be created as needed.

tellyworth avatar Nov 06 '20 00:11 tellyworth

I un-checklisted the assumption list since they're not actions. From here, I see the action(s) as

  • [x] Create a wp.org endpoint that will serve patterns (#6)
  • [x] Import core patterns into the CPT on wp.org
  • [x] Deprecate and/or Remove hardcoded core patterns from Core? back-compat concerns?
  • [x] Create a local endpoint (in Gutenberg) which will query the wp.org endpoint, like block directory endpoint (#3)
  • [x] Update GB to use this endpoint to load core patterns (server-side) https://github.com/WordPress/gutenberg/pull/28800
  • [ ] Add functionality (state/actions/etc) to dynamically load patterns client-side
  • [ ] Add support for searching the API & loading pattern results

In past conversations we haven't discussed changing the patterns UI, only the backend data source, so I think that's still a safe assumption.

ryelle avatar Nov 09 '20 22:11 ryelle

The Core patterns are all imported into the CPT now. I left the box above unchecked since we haven't removed them from Core yet.

Although, I'd be tempted to just mark the wp-includes/block-patterns/ as deprecated, but leave them permanently 🤔

Removing them would cause fatals for any plugins that are requreing them.

iandunn avatar Nov 24 '20 00:11 iandunn

I separated importing and removing into separate checklist items, so the checklist can reflect what's done and what's not.

iandunn avatar Dec 01 '20 20:12 iandunn