Skip to content

Commit

Permalink
Add Hide teaser help text in More block. (#13630)
Browse files Browse the repository at this point in the history
* Add Hide teaser help text in More block.

* Update snapshort for the unit test covering More block
  • Loading branch information
gziolo authored and youknowriad committed Mar 6, 2019
1 parent e4fbcc4 commit 1e37982
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
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

0 comments on commit 1e37982

Please sign in to comment.