diff --git a/blocks/library/pullquote/editor.scss b/blocks/library/pullquote/editor.scss index 2924c16cdc075..ed1bb6b6e21f0 100644 --- a/blocks/library/pullquote/editor.scss +++ b/blocks/library/pullquote/editor.scss @@ -11,7 +11,7 @@ } .wp-block-pullquote { - footer .blocks-editable__tinymce[data-is-empty="true"]:before { + cite .blocks-editable__tinymce[data-is-empty="true"]:before { font-size: 14px; font-family: $default-font; } diff --git a/blocks/library/pullquote/index.js b/blocks/library/pullquote/index.js index d347017a880b3..fc55e75ecf0ed 100644 --- a/blocks/library/pullquote/index.js +++ b/blocks/library/pullquote/index.js @@ -24,6 +24,27 @@ const toEditableValue = value => map( value, ( subValue => subValue.children ) ) const fromEditableValue = value => map( value, ( subValue ) => ( { children: subValue, } ) ); +const blockAttributes = { + value: { + type: 'array', + source: 'query', + selector: 'blockquote > p', + query: { + children: { + source: 'node', + }, + }, + }, + citation: { + type: 'array', + source: 'children', + selector: 'cite', + }, + align: { + type: 'string', + default: 'none', + }, +}; registerBlockType( 'core/pullquote', { @@ -33,27 +54,7 @@ registerBlockType( 'core/pullquote', { category: 'formatting', - attributes: { - value: { - type: 'array', - source: 'query', - selector: 'blockquote > p', - query: { - children: { - source: 'node', - }, - }, - }, - citation: { - type: 'array', - source: 'children', - selector: 'footer', - }, - align: { - type: 'string', - default: 'none', - }, - }, + attributes: blockAttributes, getEditWrapperProps( attributes ) { const { align } = attributes; @@ -123,9 +124,35 @@ registerBlockType( 'core/pullquote', {

{ paragraph.children && paragraph.children.props.children }

) } { citation && citation.length > 0 && ( - + { citation } ) } ); }, + + deprecated: [ { + attributes: { + ...blockAttributes, + citation: { + type: 'array', + source: 'children', + selector: 'footer', + }, + }, + + save( { attributes } ) { + const { value, citation, align } = attributes; + + return ( +
+ { value && value.map( ( paragraph, i ) => +

{ paragraph.children && paragraph.children.props.children }

+ ) } + { citation && citation.length > 0 && ( + + ) } +
+ ); + }, + } ], } ); diff --git a/blocks/library/pullquote/style.scss b/blocks/library/pullquote/style.scss index af503e5fda0e6..8abc0c66ef0e6 100644 --- a/blocks/library/pullquote/style.scss +++ b/blocks/library/pullquote/style.scss @@ -21,7 +21,7 @@ line-height: 1.6; } - footer { + cite { color: $dark-gray-600; position: relative; font-weight: 900; @@ -29,7 +29,7 @@ font-size: 13px; } - footer p { + cite p { font-family: $default-font; } } diff --git a/blocks/library/quote/style.scss b/blocks/library/quote/style.scss index ecdeb7380d5c2..19912a9e1fa86 100644 --- a/blocks/library/quote/style.scss +++ b/blocks/library/quote/style.scss @@ -2,7 +2,7 @@ margin: 0 0 16px; box-shadow: inset 0px 0px 0px 0px $light-gray-500; - footer { + cite { color: $dark-gray-100; margin-top: 1em; position: relative; @@ -17,7 +17,7 @@ font-style: italic; line-height: 1.6; } - footer { + cite { font-size: 19px; text-align: right; } diff --git a/blocks/test/fixtures/core__pullquote.html b/blocks/test/fixtures/core__pullquote.html index 8502db91311c1..06d1ea9ab6114 100644 --- a/blocks/test/fixtures/core__pullquote.html +++ b/blocks/test/fixtures/core__pullquote.html @@ -1,5 +1,5 @@
-

Testing pullquote block...

+

Testing pullquote block...

...with a caption
diff --git a/blocks/test/fixtures/core__pullquote.json b/blocks/test/fixtures/core__pullquote.json index e264a2bafd908..5ebe0b5564fb2 100644 --- a/blocks/test/fixtures/core__pullquote.json +++ b/blocks/test/fixtures/core__pullquote.json @@ -23,6 +23,6 @@ ], "align": "none" }, - "originalContent": "
\n

Testing pullquote block...

\n
" + "originalContent": "
\n

Testing pullquote block...

...with a caption\n
" } ] diff --git a/blocks/test/fixtures/core__pullquote.parsed.json b/blocks/test/fixtures/core__pullquote.parsed.json index b2f37bebc98be..4a96da0d5574b 100644 --- a/blocks/test/fixtures/core__pullquote.parsed.json +++ b/blocks/test/fixtures/core__pullquote.parsed.json @@ -3,7 +3,7 @@ "blockName": "core/pullquote", "attrs": null, "innerBlocks": [], - "innerHTML": "\n
\n

Testing pullquote block...

\n
\n" + "innerHTML": "\n
\n

Testing pullquote block...

...with a caption\n
\n" }, { "attrs": {}, diff --git a/blocks/test/fixtures/core__pullquote.serialized.html b/blocks/test/fixtures/core__pullquote.serialized.html index 8dbdbe613ad15..6aa8fe7d115ec 100644 --- a/blocks/test/fixtures/core__pullquote.serialized.html +++ b/blocks/test/fixtures/core__pullquote.serialized.html @@ -1,6 +1,4 @@
-

Testing pullquote block...

- -
+

Testing pullquote block...

...with a caption diff --git a/blocks/test/fixtures/core__pullquote__multi-paragraph.html b/blocks/test/fixtures/core__pullquote__multi-paragraph.html index ad3fbe53cefa1..113d829d01329 100644 --- a/blocks/test/fixtures/core__pullquote__multi-paragraph.html +++ b/blocks/test/fixtures/core__pullquote__multi-paragraph.html @@ -2,6 +2,6 @@

Paragraph one

Paragraph two

- + by whomever
diff --git a/blocks/test/fixtures/core__pullquote__multi-paragraph.json b/blocks/test/fixtures/core__pullquote__multi-paragraph.json index 060480767a299..29eed74d38b3b 100644 --- a/blocks/test/fixtures/core__pullquote__multi-paragraph.json +++ b/blocks/test/fixtures/core__pullquote__multi-paragraph.json @@ -47,6 +47,6 @@ ], "align": "none" }, - "originalContent": "
\n

Paragraph one

\n

Paragraph two

\n \n
" + "originalContent": "
\n

Paragraph one

\n

Paragraph two

\n by whomever\n
" } ] diff --git a/blocks/test/fixtures/core__pullquote__multi-paragraph.parsed.json b/blocks/test/fixtures/core__pullquote__multi-paragraph.parsed.json index a1aae99afd82f..4821344abd80a 100644 --- a/blocks/test/fixtures/core__pullquote__multi-paragraph.parsed.json +++ b/blocks/test/fixtures/core__pullquote__multi-paragraph.parsed.json @@ -3,7 +3,7 @@ "blockName": "core/pullquote", "attrs": null, "innerBlocks": [], - "innerHTML": "\n
\n

Paragraph one

\n

Paragraph two

\n \n
\n" + "innerHTML": "\n
\n

Paragraph one

\n

Paragraph two

\n by whomever\n
\n" }, { "attrs": {}, diff --git a/blocks/test/fixtures/core__pullquote__multi-paragraph.serialized.html b/blocks/test/fixtures/core__pullquote__multi-paragraph.serialized.html index 8d90207d382dd..e250273ded2b7 100644 --- a/blocks/test/fixtures/core__pullquote__multi-paragraph.serialized.html +++ b/blocks/test/fixtures/core__pullquote__multi-paragraph.serialized.html @@ -1,7 +1,5 @@

Paragraph one

-

Paragraph two

- -
+

Paragraph two

by whomever diff --git a/phpunit/fixtures/long-content.html b/phpunit/fixtures/long-content.html index 4008a79305151..4ed0e28666f8d 100644 --- a/phpunit/fixtures/long-content.html +++ b/phpunit/fixtures/long-content.html @@ -110,7 +110,7 @@

Media Rich

Code is Poetry

- +The WordPress community
diff --git a/post-content.js b/post-content.js index e993898bd94dd..15a8fc3084406 100644 --- a/post-content.js +++ b/post-content.js @@ -135,7 +135,7 @@ window._wpGutenbergPost.content = { '', '', - '

Code is Poetry

', + '

Code is Poetry

The WordPress community
', '', '',