-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Featured Image, Title and Excerpt to top of the settings sidebar
- Moves the Featured Image panel to the top of the sidebar. - Uses a new dropdown-based flow for selecting a featured image. - Adds the ability to upload a featured image using the native file picker. - Adds a new Summary component to top of the sidebar containing fields for modifying the post's title and excerpt. - Removes the Excerpt panel in favour of excerpt field in Summary component.
- Loading branch information
1 parent
233142b
commit 4dbafb2
Showing
23 changed files
with
420 additions
and
288 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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 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
73 changes: 0 additions & 73 deletions
73
packages/edit-post/src/components/sidebar/featured-image/index.js
This file was deleted.
Oops, something went wrong.
56 changes: 0 additions & 56 deletions
56
packages/edit-post/src/components/sidebar/post-excerpt/index.js
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
packages/edit-post/src/components/sidebar/post-featured-image/index.js
This file contains 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,18 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { | ||
PostFeaturedImageCheck, | ||
PostFeaturedImage as PostFeaturedImageForm, | ||
} from '@wordpress/editor'; | ||
import { MediaUploadCheck } from '@wordpress/block-editor'; | ||
|
||
export default function PostFeaturedImage() { | ||
return ( | ||
<PostFeaturedImageCheck> | ||
<MediaUploadCheck> | ||
<PostFeaturedImageForm className="edit-post-post-featured-image" /> | ||
</MediaUploadCheck> | ||
</PostFeaturedImageCheck> | ||
); | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/edit-post/src/components/sidebar/post-featured-image/style.scss
This file contains 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,11 @@ | ||
.edit-post-post-featured-image { | ||
.editor-post-featured-image__container { | ||
margin-left: -$grid-unit-20; | ||
margin-right: -$grid-unit-20; | ||
} | ||
|
||
.editor-post-featured-image__toggle { | ||
border-bottom: $border-width solid $gray-200; | ||
border-top: $border-width solid $gray-200; | ||
} | ||
} |
This file contains 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
8 changes: 4 additions & 4 deletions
8
packages/edit-post/src/components/sidebar/post-status/style.scss
This file contains 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.edit-post-post-status .edit-post-post-publish-dropdown__switch-to-draft { | ||
margin-top: 15px; | ||
width: 100%; | ||
text-align: center; | ||
.edit-post-post-status { | ||
[class].components-panel__body-title { | ||
margin-bottom: 0; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
packages/edit-post/src/components/sidebar/post-summary/excerpt.js
This file contains 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,26 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useSelect, useDispatch } from '@wordpress/data'; | ||
import { store as editorStore } from '@wordpress/editor'; | ||
import { PlainText } from '@wordpress/block-editor'; | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
export default function PostSummaryExcerpt() { | ||
const excerpt = useSelect( | ||
( select ) => select( editorStore ).getEditedPostAttribute( 'excerpt' ), | ||
[] | ||
); | ||
|
||
const { editPost } = useDispatch( editorStore ); | ||
|
||
return ( | ||
<PlainText | ||
__experimentalVersion={ 2 } | ||
className="edit-post-post-summary__excerpt" | ||
placeholder={ __( 'Add excerpt' ) } | ||
value={ excerpt } | ||
onChange={ ( value ) => editPost( { excerpt: value } ) } | ||
/> | ||
); | ||
} |
23 changes: 23 additions & 0 deletions
23
packages/edit-post/src/components/sidebar/post-summary/index.js
This file contains 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,23 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { PostTypeSupportCheck, PostExcerptCheck } from '@wordpress/editor'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import PostSummaryTitle from './title'; | ||
import PostSummaryExcerpt from './excerpt'; | ||
|
||
export default function PostSummary() { | ||
return ( | ||
<div className="edit-post-post-summary"> | ||
<PostTypeSupportCheck supportKeys="title"> | ||
<PostSummaryTitle /> | ||
</PostTypeSupportCheck> | ||
<PostExcerptCheck> | ||
<PostSummaryExcerpt /> | ||
</PostExcerptCheck> | ||
</div> | ||
); | ||
} |
21 changes: 21 additions & 0 deletions
21
packages/edit-post/src/components/sidebar/post-summary/style.scss
This file contains 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,21 @@ | ||
.edit-post-post-summary { | ||
border-bottom: $border-width solid $gray-200; | ||
border-top: $border-width solid $gray-200; | ||
margin-left: -$grid-unit-20; | ||
margin-right: -$grid-unit-20; | ||
padding: $grid-unit-10 $grid-unit-20 $grid-unit-20; | ||
|
||
.edit-post-post-featured-image + & { | ||
margin-top: -1px; | ||
} | ||
} | ||
|
||
.edit-post-post-summary__title, | ||
.edit-post-post-summary__excerpt { | ||
margin-top: $grid-unit-10; | ||
} | ||
|
||
.edit-post-post-summary__title { | ||
font-size: 16px; | ||
font-weight: 600; | ||
} |
Oops, something went wrong.