Skip to content

Commit

Permalink
Add aside wrapper to pullquote
Browse files Browse the repository at this point in the history
This is an alternative, per discussion, to #8821.

It adds some semantic value to the pullquote, indicating that it is intended to be separate content.

Note that we should consider doing a few other enhancements to the pullquote, if we intend to keep it:

- Let's add a transformation from Quote to Pullquote and back
- For some reason, the alignment values are not output in the markup in the editor, only on the frontend, which means the max-width we apply does not affect the content.

I could use help with both of these. I also imagine the deprecation handler needs a little extra now. @gziolo do you have bandwidth?
  • Loading branch information
Joen Asmussen authored and jorgefilipecosta committed Sep 11, 2018
1 parent a0dfb14 commit 67afd73
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 27 deletions.
4 changes: 2 additions & 2 deletions packages/block-library/src/pullquote/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
transform: translateX(-50%);
}

& > .block-library-pullquote__content .editor-rich-text__tinymce[data-is-empty="true"]::before,
& > .editor-rich-text p {
& blockquote > .block-library-pullquote__content .editor-rich-text__tinymce[data-is-empty="true"]::before,
& blockquote > .editor-rich-text p {
font-size: 24px;
line-height: 1.6;
}
Expand Down
46 changes: 24 additions & 22 deletions packages/block-library/src/pullquote/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,33 +55,35 @@ export const settings = {
const { value, citation } = attributes;

return (
<blockquote className={ className }>
<RichText
multiline="p"
value={ toRichTextValue( value ) }
onChange={
( nextValue ) => setAttributes( {
value: fromRichTextValue( nextValue ),
} )
}
/* translators: the text of the quotation */
placeholder={ __( 'Write quote…' ) }
wrapperClassName="block-library-pullquote__content"
/>
{ ( ! RichText.isEmpty( citation ) || isSelected ) && (
<aside className={ className }>
<blockquote>
<RichText
value={ citation }
/* translators: the individual or entity quoted */
placeholder={ __( 'Write citation…' ) }
multiline="p"
value={ toRichTextValue( value ) }
onChange={
( nextCitation ) => setAttributes( {
citation: nextCitation,
( nextValue ) => setAttributes( {
value: fromRichTextValue( nextValue ),
} )
}
className="wp-block-pullquote__citation"
/* translators: the text of the quotation */
placeholder={ __( 'Write quote…' ) }
wrapperClassName="block-library-pullquote__content"
/>
) }
</blockquote>
{ ( ! RichText.isEmpty( citation ) || isSelected ) && (
<RichText
value={ citation }
/* translators: the individual or entity quoted */
placeholder={ __( 'Write citation…' ) }
onChange={
( nextCitation ) => setAttributes( {
citation: nextCitation,
} )
}
className="wp-block-pullquote__citation"
/>
) }
</blockquote>
</aside>
);
},

Expand Down
6 changes: 3 additions & 3 deletions packages/block-library/src/pullquote/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

&.alignleft,
&.alignright {
max-width: 400px;
max-width: $content-width / 2;

> p {
p {
font-size: 20px;
}
}

> p {
p {
font-size: 24px;
line-height: 1.6;
}
Expand Down

0 comments on commit 67afd73

Please sign in to comment.