-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Site Editor: Add Library for Template Parts & Patterns Management #51078
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
Merged
Merged
Changes from 58 commits
Commits
Show all changes
73 commits
Select commit
Hold shift + click to select a range
d3731da
Add placeholder Library page
aaronrobertshaw a46d4b5
Add placeholder Library nav screen
aaronrobertshaw 6c2a135
Use placeholder library page and nav screen
aaronrobertshaw 01b56ae
Add dodgy placeholder display for patterns or template parts
aaronrobertshaw e59b587
Temporarily add category type and name to query params
aaronrobertshaw 3221044
Try displaying patterns and template parts
aaronrobertshaw b617274
Highlight active category nav item
aaronrobertshaw 4f15ff1
Add placeholder dropdown for deleting patterns
aaronrobertshaw 330cee3
Try making pattern previews clickable
aaronrobertshaw 7514f83
Add placeholder create pattern modal and action
aaronrobertshaw 2fa73e0
Add category select to create pattern modal
aaronrobertshaw 99f540b
Remove the library url params when existing library
glendaviesnz 32a8f6d
Fix pattern styles not loading on fresh reload of Library page (#51114)
talldan 1ef2c8b
Hook up template part preview to existing edit page
aaronrobertshaw 0123b0b
Fix template part pattern display in library
aaronrobertshaw 0b6737d
Try retrieving user created patterns from wp_block CPT
aaronrobertshaw dc0d64f
Update now user created patterns have category arrays
aaronrobertshaw aa30958
Update user created patterns based of new meta wp_block property
aaronrobertshaw 0be9c45
Remove new template part screen as it was covered by pattern screen
aaronrobertshaw 46d8130
Allow user created patterns to be clicked on
aaronrobertshaw 8348699
Fix typos
aaronrobertshaw 4860faf
Fix classnames
aaronrobertshaw 1bc7c91
Hook up reusable block editing
aaronrobertshaw 96c9e55
Try adding delete for user patterns
aaronrobertshaw bd53f4c
Add snackbar notices for user-created pattern deletion
aaronrobertshaw f1ba5ac
Hook up pattern creation modal
aaronrobertshaw 6675328
Make new patterns return to correct category
aaronrobertshaw 0046f1d
Try updating the Library to use pattern category taxonomy
aaronrobertshaw ce25de7
Fix theme pattern display in Grid
aaronrobertshaw ea3a45f
Fix selected pattern category detection
aaronrobertshaw 2117805
Use invalidateResolution to clear taxonomy cache
aaronrobertshaw 027296c
Include uncategorized reusable block patterns in Library
aaronrobertshaw 53bcb37
Make pattern category selection option and add sync toggle
aaronrobertshaw 4950429
Separate display of synced/unsynced patterns
aaronrobertshaw a3bc282
Add placeholder search control.
aaronrobertshaw 50a084a
Update to use new Page components added along with Table
aaronrobertshaw a1acfc0
Fix private apis imports
aaronrobertshaw d0830f5
style changes to library
SaxonF cc5ee06
copy change
SaxonF 9da0092
svg colour
SaxonF a5cc78d
add template part and pattern dialog
SaxonF 5ffe5e3
fix template part modal close
SaxonF c55ad6f
Try filtering of patterns in library
aaronrobertshaw c90f2c3
search input patterns style
SaxonF c404b3f
responsive pattern grid
SaxonF bf13603
Use only default block pattern categories
aaronrobertshaw d5c8b58
Fix Library routing in mobile (#51558)
kevin940726 425759b
Remove obselete TODO comments
aaronrobertshaw e54aa4b
Use extracted useDebouncedInput hook
aaronrobertshaw 051b749
Fix clicking browser's back button in edit mode from the Library (#51…
kevin940726 e4c997b
Rename Your Patterns to Custom patterns
aaronrobertshaw c227bb5
Remove arrow functions for internal Grid components
aaronrobertshaw c1c087c
Fix linting error
aaronrobertshaw df6177a
Add dependencies to package-lock.json
aaronrobertshaw 8fd05d0
Update core pattern filtering
aaronrobertshaw eab0181
Consolidate and reuse constants
aaronrobertshaw b7b9881
Clean up comments and unused styles
aaronrobertshaw 00f1623
Rename manage all link for custom patterns
aaronrobertshaw 0137777
Remove `wp_block` property from post meta for patterns
talldan 59b4b0c
Update conversion of reusable block to pattern after sync_status moved
aaronrobertshaw 17ec997
Rename setReusableBlock to setEditedEntity
aaronrobertshaw 51c9d7e
Improve wording
aaronrobertshaw e2f672a
Add aria description for pattern action menu
talldan a263e16
Refactor filtering out duplicate patterns by name
aaronrobertshaw df1c567
Add focus style for patterns
talldan 5d94265
Add empty pattern placeholder
aaronrobertshaw c496134
Fix tests and converter flow
kevin940726 5bdd114
Tweak focused placeholder styles
aaronrobertshaw 6d7b0d6
Make the action menu unfocusable and use a keyboard shortcut for dele…
talldan 4aa656a
Add confirm step for deleting
talldan fa179de
Add a more descriptive aria-description
talldan 50a1383
Ensure pattern lists are announced with the correct number of items
talldan ea08bb0
Improve labelling of pattern lists
talldan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
packages/edit-site/src/components/add-new-pattern/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| /** | ||
| * WordPress dependencies | ||
| */ | ||
| import { DropdownMenu } from '@wordpress/components'; | ||
| import { useState } from '@wordpress/element'; | ||
| import { __ } from '@wordpress/i18n'; | ||
| import { plus, header, file } from '@wordpress/icons'; | ||
| import { privateApis as routerPrivateApis } from '@wordpress/router'; | ||
|
|
||
| /** | ||
| * Internal dependencies | ||
| */ | ||
| import CreatePatternModal from '../create-pattern-modal'; | ||
| import CreateTemplatePartModal from '../create-template-part-modal'; | ||
| import { unlock } from '../../lock-unlock'; | ||
| import SidebarButton from '../sidebar-button'; | ||
|
|
||
| const { useHistory } = unlock( routerPrivateApis ); | ||
|
|
||
| export default function AddNewPattern() { | ||
| const history = useHistory(); | ||
| const [ showPatternModal, setShowPatternModal ] = useState( false ); | ||
| const [ showTemplatePartModal, setShowTemplatePartModal ] = | ||
| useState( false ); | ||
|
|
||
| function handleCreatePattern( { pattern, categoryId } ) { | ||
| setShowPatternModal( false ); | ||
|
|
||
| history.push( { | ||
| postId: pattern.id, | ||
| postType: 'wp_block', | ||
| categoryType: 'wp_block', | ||
| categoryId, | ||
| canvas: 'edit', | ||
| } ); | ||
| } | ||
|
|
||
| function handleCreateTemplatePart( templatePart ) { | ||
| setShowTemplatePartModal( false ); | ||
|
|
||
| // Navigate to the created template part editor. | ||
| history.push( { | ||
| postId: templatePart.id, | ||
| postType: 'wp_template_part', | ||
| canvas: 'edit', | ||
| } ); | ||
| } | ||
|
|
||
| function handleError() { | ||
| setShowPatternModal( false ); | ||
| setShowTemplatePartModal( false ); | ||
| } | ||
|
|
||
| return ( | ||
| <> | ||
| <DropdownMenu | ||
| controls={ [ | ||
| { | ||
| icon: header, | ||
| onClick: () => setShowTemplatePartModal( true ), | ||
| title: 'Create a template part', | ||
| }, | ||
| { | ||
| icon: file, | ||
| onClick: () => setShowPatternModal( true ), | ||
| title: 'Create a pattern', | ||
| }, | ||
| ] } | ||
| icon={ | ||
| <SidebarButton | ||
| icon={ plus } | ||
| label={ __( 'Create a pattern' ) } | ||
| /> | ||
| } | ||
| label="Create a pattern." | ||
| /> | ||
| { showPatternModal && ( | ||
| <CreatePatternModal | ||
| closeModal={ () => setShowPatternModal( false ) } | ||
| onCreate={ handleCreatePattern } | ||
| onError={ handleError } | ||
| /> | ||
| ) } | ||
| { showTemplatePartModal && ( | ||
| <CreateTemplatePartModal | ||
| closeModal={ () => setShowTemplatePartModal( false ) } | ||
| onCreate={ handleCreateTemplatePart } | ||
| onError={ handleError } | ||
| /> | ||
| ) } | ||
| </> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.