-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Experiment: Make unsynced patterns content only by default #71512
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
Changes from 1 commit
cb2b37c
e4b5aa9
fcb9d90
110543e
8b2215a
7ef7e40
a418ac2
06b32fc
361f633
5641787
f7ed41e
cbdced9
73b967f
53b33c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,11 +11,32 @@ import { selectBlockPatternsKey } from './private-keys'; | |
| import { unlock } from '../lock-unlock'; | ||
| import { STORE_NAME } from './constants'; | ||
| import { getSectionRootClientId } from './private-selectors'; | ||
| import { INSERTER_PATTERN_TYPES } from '../components/inserter/block-patterns-tab/utils'; | ||
|
|
||
| export const isFiltered = Symbol( 'isFiltered' ); | ||
| const parsedPatternCache = new WeakMap(); | ||
| const grammarMapCache = new WeakMap(); | ||
|
|
||
| export function mapUserPattern( | ||
| userPattern, | ||
| __experimentalUserPatternCategories = [] | ||
| ) { | ||
| return { | ||
| name: `core/block/${ userPattern.id }`, | ||
| id: userPattern.id, | ||
| type: INSERTER_PATTERN_TYPES.user, | ||
| title: userPattern.title.raw, | ||
| categories: userPattern.wp_pattern_category?.map( ( catId ) => { | ||
| const category = __experimentalUserPatternCategories.find( | ||
| ( { id } ) => id === catId | ||
| ); | ||
| return category ? category.slug : catId; | ||
| } ), | ||
| content: userPattern.content.raw, | ||
|
||
| syncStatus: userPattern.wp_pattern_sync_status, | ||
| }; | ||
| } | ||
|
|
||
| function parsePattern( pattern ) { | ||
| const blocks = parse( pattern.content, { | ||
| __unstableSkipMigrationLogs: true, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is working well now!
One thing that would also be good to fix is having theme patterns appear in the slash inserter; currently they don't. But that can be addressed separately!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, lets treat is as separate, I'm not sure if there's a reason they're omitted.
If we can include them I think it would help tidy up some of the Inserter code.