Skip to content

Commit

Permalink
Fix quote block transforms
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Oct 29, 2018
1 parent 9ff5b93 commit dc5a085
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 2 additions & 3 deletions packages/block-library/src/quote/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const settings = {
blocks: [ 'core/paragraph' ],
transform: ( { value, citation } ) => {
const paragraphs = [];
if ( value ) {
if ( value && value !== '<p></p>' ) {
paragraphs.push(
...split( create( { html: value, multilineTag: 'p' } ), '\u2028' )
.map( ( piece ) =>
Expand All @@ -118,7 +118,7 @@ export const settings = {
)
);
}
if ( citation ) {
if ( citation && citation !== '<p></p>' ) {
paragraphs.push(
createBlock( 'core/paragraph', {
content: citation,
Expand Down Expand Up @@ -179,7 +179,6 @@ export const settings = {

edit( { attributes, setAttributes, isSelected, mergeBlocks, onReplace, className } ) {
const { align, value, citation } = attributes;

return (
<Fragment>
<BlockControls>
Expand Down
6 changes: 5 additions & 1 deletion test/e2e/specs/blocks/__snapshots__/quote.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ exports[`Quote can be converted to paragraphs and renders a paragraph for the ci
<!-- /wp:paragraph -->"
`;
exports[`Quote can be converted to paragraphs and renders a void paragraph if both the cite and quote are void 1`] = `""`;
exports[`Quote can be converted to paragraphs and renders a void paragraph if both the cite and quote are void 1`] = `
"<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->"
`;
exports[`Quote can be converted to paragraphs and renders one paragraph block per <p> within quote 1`] = `
"<!-- wp:paragraph -->
Expand Down

0 comments on commit dc5a085

Please sign in to comment.