Skip to content
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

Add Hide teaser help text in More block. #13630

Merged
merged 2 commits into from
Feb 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions packages/block-library/src/more/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,17 @@ export default class MoreEdit extends Component {
}
}

getHideExcerptHelp( checked ) {
return checked ?
__( 'The excerpt is hidden.' ) :
__( 'The excerpt is visible.' );
}

render() {
const { customText, noTeaser } = this.props.attributes;
const { setAttributes } = this.props;

const toggleNoTeaser = () => setAttributes( { noTeaser: ! noTeaser } );
const toggleHideExcerpt = () => setAttributes( { noTeaser: ! noTeaser } );
const { defaultText } = this.state;
const value = customText !== undefined ? customText : defaultText;
const inputLength = value.length + 1;
Expand All @@ -54,9 +60,10 @@ export default class MoreEdit extends Component {
<InspectorControls>
<PanelBody>
<ToggleControl
label={ __( 'Hide the teaser before the "More" tag' ) }
label={ __( 'Hide the excerpt on the full content page' ) }
checked={ !! noTeaser }
onChange={ toggleNoTeaser }
onChange={ toggleHideExcerpt }
help={ this.getHideExcerptHelp }
/>
</PanelBody>
</InspectorControls>
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/more/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const name = 'core/more';
export const settings = {
title: _x( 'More', 'block name' ),

description: __( 'Mark the excerpt of this content. Content before this block will be shown in the excerpt on your archives page.' ),
description: __( 'Content before this block will be shown in the excerpt on your archives page.' ),

icon: <SVG viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><Path fill="none" d="M0 0h24v24H0V0z" /><G><Path d="M2 9v2h19V9H2zm0 6h5v-2H2v2zm7 0h5v-2H9v2zm7 0h5v-2h-5v2z" /></G></SVG>,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ exports[`core/more/edit should match snapshot when noTeaser is false 1`] = `
<ForwardRef(PanelBody)>
<WithInstanceId(ToggleControl)
checked={false}
label="Hide the teaser before the \\"More\\" tag"
help={[Function]}
label="Hide the excerpt on the full content page"
onChange={[Function]}
/>
</ForwardRef(PanelBody)>
Expand All @@ -31,7 +32,8 @@ exports[`core/more/edit should match snapshot when noTeaser is true 1`] = `
<ForwardRef(PanelBody)>
<WithInstanceId(ToggleControl)
checked={true}
label="Hide the teaser before the \\"More\\" tag"
help={[Function]}
label="Hide the excerpt on the full content page"
onChange={[Function]}
/>
</ForwardRef(PanelBody)>
Expand Down