Skip to content

Commit

Permalink
Use a number for quote style
Browse files Browse the repository at this point in the history
  • Loading branch information
nylen committed Apr 21, 2017
1 parent c844bd5 commit 968ec56
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions blocks/library/quote/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,19 @@ registerBlock( 'core/quote', {
citation: html( 'footer' )
},

controls: [ '1', '2' ].map( ( variation ) => ( {
controls: [ 1, 2 ].map( ( variation ) => ( {
icon: 'format-quote',
title: wp.i18n.sprintf( wp.i18n.__( 'Quote %s' ), variation ),
isActive: ( { style = '1' } ) => style === variation,
title: wp.i18n.sprintf( wp.i18n.__( 'Quote %d' ), variation ),
isActive: ( { style = 1 } ) => +style === +variation,
onClick( attributes, setAttributes ) {
setAttributes( { style: variation } );
},
subscript: variation
} ) ),

edit( { attributes, setAttributes, focus, setFocus } ) {
const { value, citation, style = '1' } = attributes;
const { value, citation } = attributes;
const style = +attributes.style || 1;

return (
<blockquote className={ `blocks-quote blocks-quote-style-${ style }` }>
Expand Down Expand Up @@ -64,7 +65,8 @@ registerBlock( 'core/quote', {
},

save( attributes ) {
const { value, citation, style = '1' } = attributes;
const { value, citation } = attributes;
const style = +attributes.style || 1;

return (
<blockquote className={ `blocks-quote-style-${ style }` }>
Expand Down
2 changes: 1 addition & 1 deletion languages/gutenberg.pot
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ msgid "Quote"
msgstr ""

#: blocks/library/quote/index.js:25
msgid "Quote %s"
msgid "Quote %d"
msgstr ""

#: blocks/library/text/index.js:13
Expand Down

0 comments on commit 968ec56

Please sign in to comment.