From 99cc1f0b693b5060f733c8d618b1c122d8c88ce8 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Tue, 23 May 2017 11:30:21 +0100 Subject: [PATCH 1/4] Chrome: Adding the post excerpt panel --- editor/selectors.js | 6 ++++ editor/sidebar/post-excerpt/index.js | 50 ++++++++++++++++++++++++++ editor/sidebar/post-excerpt/style.scss | 6 ++++ editor/sidebar/post-settings/index.js | 2 ++ editor/test/selectors.js | 29 +++++++++++++++ 5 files changed, 93 insertions(+) create mode 100644 editor/sidebar/post-excerpt/index.js create mode 100644 editor/sidebar/post-excerpt/style.scss diff --git a/editor/selectors.js b/editor/selectors.js index 886314c4082b5..1abd6376fda36 100644 --- a/editor/selectors.js +++ b/editor/selectors.js @@ -64,6 +64,12 @@ export function getEditedPostTitle( state ) { : state.editor.edits.title; } +export function getEditedPostExcerpt( state ) { + return state.editor.edits.excerpt === undefined + ? state.currentPost.excerpt.raw + : state.editor.edits.excerpt; +} + export function getEditedPostPreviewLink( state ) { const link = state.currentPost.link; if ( ! link ) { diff --git a/editor/sidebar/post-excerpt/index.js b/editor/sidebar/post-excerpt/index.js new file mode 100644 index 0000000000000..df0615690f162 --- /dev/null +++ b/editor/sidebar/post-excerpt/index.js @@ -0,0 +1,50 @@ +/** + * External dependencies + */ +import { connect } from 'react-redux'; + +/** + * WordPress dependencies + */ +import { __ } from 'i18n'; +import PanelBody from 'components/panel/body'; + +/** + * Internal Dependencies + */ +import './style.scss'; +import { getEditedPostExcerpt } from '../../selectors'; +import { editPost } from '../../actions'; + +function PostExcerpt( { excerpt, onUpdateExcerpt } ) { + const onChange = ( event ) => onUpdateExcerpt( event.target.value ); + + return ( + +