From 495ccc86de805f6ca3ba7cb39400a2f50846d9d6 Mon Sep 17 00:00:00 2001 From: Joen Asmussen Date: Fri, 10 Aug 2018 11:20:07 +0200 Subject: [PATCH 1/2] WIP/Try: Make pullquote a variation This PR takes a meager stab at #5947 by copying the pullquote styles to the basic quote block and making it a variation, now titled "Elaborate". Name aside, which is up for discussion, this PR is mostly intended to get the ball rolling on eventually doing this, vs. keeping the status quo. If we mean to move forward, aside from feedback, the actual pullquote needs to be deprecated and removed, and I'd need help doing that as I assume it's not enough to just delete the pullquote folder. One issue already surfaced from this: the pullquote block features block level alignments, whereas the quote block features only inline level alignments (text align). That means you can float the pullquote, but not the quote. At least not yet, though presumably with a container block you'd be able to do that in the future. What are your thoughts on how to move forward with this? --- packages/block-library/src/quote/index.js | 1 + packages/block-library/src/quote/style.scss | 21 +++++++++++++++++++++ packages/block-library/src/quote/theme.scss | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/packages/block-library/src/quote/index.js b/packages/block-library/src/quote/index.js index c63ff379114e5..475d3eb746045 100644 --- a/packages/block-library/src/quote/index.js +++ b/packages/block-library/src/quote/index.js @@ -55,6 +55,7 @@ export const settings = { styles: [ { name: 'default', label: __( 'Regular' ), isDefault: true }, { name: 'large', label: __( 'Large' ) }, + { name: 'fancy', label: __( 'Fancy' ) }, ], transforms: { diff --git a/packages/block-library/src/quote/style.scss b/packages/block-library/src/quote/style.scss index c1206d68958f7..a8a1400f76e5e 100644 --- a/packages/block-library/src/quote/style.scss +++ b/packages/block-library/src/quote/style.scss @@ -16,4 +16,25 @@ text-align: right; } } + + &.is-style-fancy { + padding: 3em 0; + text-align: center; + border-top: 4px solid $dark-gray-500; + border-bottom: 4px solid $dark-gray-500; + color: $dark-gray-600; + + p { + font-size: 24px; + line-height: 1.6; + } + + cite, + footer { + position: relative; + color: $dark-gray-600; + text-transform: uppercase; + font-size: $default-font-size; + } + } } diff --git a/packages/block-library/src/quote/theme.scss b/packages/block-library/src/quote/theme.scss index df07d206febe5..fab98c19c1516 100644 --- a/packages/block-library/src/quote/theme.scss +++ b/packages/block-library/src/quote/theme.scss @@ -11,7 +11,7 @@ } } -.wp-block-quote:not(.is-large):not(.is-style-large) { +.wp-block-quote:not(.is-large):not(.is-style-large):not(.is-style-fancy) { border-left: 4px solid $black; padding-left: 1em; } From f76985ce00c1bedab3615cdee013097d7d422233 Mon Sep 17 00:00:00 2001 From: Joen Asmussen Date: Fri, 24 Aug 2018 10:46:29 +0200 Subject: [PATCH 2/2] Try simply removing the pullquote. --- block-library/index.js | 2 - packages/block-library/src/editor.scss | 1 - packages/block-library/src/index.js | 2 - .../block-library/src/pullquote/editor.scss | 32 ----- packages/block-library/src/pullquote/index.js | 124 ------------------ .../block-library/src/pullquote/style.scss | 23 ---- .../test/__snapshots__/index.js.snap | 37 ------ .../block-library/src/pullquote/test/index.js | 13 -- .../block-library/src/pullquote/theme.scss | 12 -- packages/block-library/src/style.scss | 1 - packages/block-library/src/theme.scss | 2 - packages/editor/src/store/selectors.js | 2 - phpunit/fixtures/long-content.html | 6 - post-content.php | 4 - .../fixtures/core__pullquote.html | 5 - .../fixtures/core__pullquote.json | 26 ---- .../fixtures/core__pullquote.parsed.json | 12 -- .../fixtures/core__pullquote.serialized.html | 3 - .../core__pullquote__multi-paragraph.html | 7 - .../core__pullquote__multi-paragraph.json | 44 ------- ...re__pullquote__multi-paragraph.parsed.json | 12 -- ...pullquote__multi-paragraph.serialized.html | 3 - 22 files changed, 373 deletions(-) delete mode 100644 packages/block-library/src/pullquote/editor.scss delete mode 100644 packages/block-library/src/pullquote/index.js delete mode 100644 packages/block-library/src/pullquote/style.scss delete mode 100644 packages/block-library/src/pullquote/test/__snapshots__/index.js.snap delete mode 100644 packages/block-library/src/pullquote/test/index.js delete mode 100644 packages/block-library/src/pullquote/theme.scss delete mode 100644 test/integration/full-content/fixtures/core__pullquote.html delete mode 100644 test/integration/full-content/fixtures/core__pullquote.json delete mode 100644 test/integration/full-content/fixtures/core__pullquote.parsed.json delete mode 100644 test/integration/full-content/fixtures/core__pullquote.serialized.html delete mode 100644 test/integration/full-content/fixtures/core__pullquote__multi-paragraph.html delete mode 100644 test/integration/full-content/fixtures/core__pullquote__multi-paragraph.json delete mode 100644 test/integration/full-content/fixtures/core__pullquote__multi-paragraph.parsed.json delete mode 100644 test/integration/full-content/fixtures/core__pullquote__multi-paragraph.serialized.html diff --git a/block-library/index.js b/block-library/index.js index b76b3ce0bee70..0afac557a4ac0 100644 --- a/block-library/index.js +++ b/block-library/index.js @@ -34,7 +34,6 @@ import * as list from '../packages/block-library/src/list'; import * as more from '../packages/block-library/src/more'; import * as nextpage from '../packages/block-library/src/nextpage'; import * as preformatted from '../packages/block-library/src/preformatted'; -import * as pullquote from '../packages/block-library/src/pullquote'; import * as reusableBlock from '../packages/block-library/src/block'; import * as separator from '../packages/block-library/src/separator'; import * as shortcode from '../packages/block-library/src/shortcode'; @@ -83,7 +82,6 @@ export const registerCoreBlocks = () => { more, nextpage, preformatted, - pullquote, separator, reusableBlock, spacer, diff --git a/packages/block-library/src/editor.scss b/packages/block-library/src/editor.scss index 60aacb91e833f..6c26aa8055ee4 100644 --- a/packages/block-library/src/editor.scss +++ b/packages/block-library/src/editor.scss @@ -15,7 +15,6 @@ @import "./more/editor.scss"; @import "./nextpage/editor.scss"; @import "./preformatted/editor.scss"; -@import "./pullquote/editor.scss"; @import "./quote/editor.scss"; @import "./shortcode/editor.scss"; @import "./spacer/editor.scss"; diff --git a/packages/block-library/src/index.js b/packages/block-library/src/index.js index abb8536486aff..7b2d85ead7bf2 100644 --- a/packages/block-library/src/index.js +++ b/packages/block-library/src/index.js @@ -30,7 +30,6 @@ import * as list from './list'; import * as more from './more'; import * as nextpage from './nextpage'; import * as preformatted from './preformatted'; -import * as pullquote from './pullquote'; import * as reusableBlock from './block'; import * as separator from './separator'; import * as shortcode from './shortcode'; @@ -71,7 +70,6 @@ export const registerCoreBlocks = () => { more, nextpage, preformatted, - pullquote, separator, reusableBlock, spacer, diff --git a/packages/block-library/src/pullquote/editor.scss b/packages/block-library/src/pullquote/editor.scss deleted file mode 100644 index d0f9c518b5e14..0000000000000 --- a/packages/block-library/src/pullquote/editor.scss +++ /dev/null @@ -1,32 +0,0 @@ -.editor-block-list__block[data-type="core/pullquote"] { - &[data-align="left"], - &[data-align="right"] { - & .block-library-pullquote__content .editor-rich-text__tinymce[data-is-empty="true"]::before, - & .editor-rich-text p { - font-size: 20px; - } - } -} - -.wp-block-pullquote { - cite { - display: block; - } - - cite .editor-rich-text__tinymce[data-is-empty="true"]::before { - font-size: 14px; - font-family: $default-font; - } - - .editor-rich-text__tinymce[data-is-empty="true"]::before { - width: 100%; - left: 50%; - transform: translateX(-50%); - } - - & > .block-library-pullquote__content .editor-rich-text__tinymce[data-is-empty="true"]::before, - & > .editor-rich-text p { - font-size: 24px; - line-height: 1.6; - } -} diff --git a/packages/block-library/src/pullquote/index.js b/packages/block-library/src/pullquote/index.js deleted file mode 100644 index 800828091282a..0000000000000 --- a/packages/block-library/src/pullquote/index.js +++ /dev/null @@ -1,124 +0,0 @@ -/** - * External dependencies - */ -import { map } from 'lodash'; - -/** - * WordPress dependencies - */ -import { __ } from '@wordpress/i18n'; -import { - RichText, -} from '@wordpress/editor'; - -const toRichTextValue = ( value ) => map( value, ( ( subValue ) => subValue.children ) ); -const fromRichTextValue = ( 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', - }, -}; - -export const name = 'core/pullquote'; - -export const settings = { - - title: __( 'Pullquote' ), - - description: __( 'Highlight a quote from your post or page by displaying it as a graphic element.' ), - - icon: , - - category: 'formatting', - - attributes: blockAttributes, - - supports: { - align: true, - }, - - edit( { attributes, setAttributes, isSelected, className } ) { - const { value, citation } = attributes; - - return ( -
- setAttributes( { - value: fromRichTextValue( nextValue ), - } ) - } - /* translators: the text of the quotation */ - placeholder={ __( 'Write quote…' ) } - wrapperClassName="block-library-pullquote__content" - /> - { ( citation || isSelected ) && ( - setAttributes( { - citation: nextCitation, - } ) - } - /> - ) } -
- ); - }, - - save( { attributes } ) { - const { value, citation } = attributes; - - return ( -
- - { citation && citation.length > 0 && } -
- ); - }, - - deprecated: [ { - attributes: { - ...blockAttributes, - citation: { - type: 'array', - source: 'children', - selector: 'footer', - }, - align: { - type: 'string', - default: 'none', - }, - }, - - save( { attributes } ) { - const { value, citation, align } = attributes; - - return ( -
- - { citation && citation.length > 0 && } -
- ); - }, - } ], -}; diff --git a/packages/block-library/src/pullquote/style.scss b/packages/block-library/src/pullquote/style.scss deleted file mode 100644 index 2467adff4e543..0000000000000 --- a/packages/block-library/src/pullquote/style.scss +++ /dev/null @@ -1,23 +0,0 @@ -.wp-block-pullquote { - padding: 3em 0; - text-align: center; - - &.alignleft, - &.alignright { - max-width: 400px; - - > p { - font-size: 20px; - } - } - - > p { - font-size: 24px; - line-height: 1.6; - } - - cite, - footer { - position: relative; - } -} diff --git a/packages/block-library/src/pullquote/test/__snapshots__/index.js.snap b/packages/block-library/src/pullquote/test/__snapshots__/index.js.snap deleted file mode 100644 index 0fb96fbe63061..0000000000000 --- a/packages/block-library/src/pullquote/test/__snapshots__/index.js.snap +++ /dev/null @@ -1,37 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`core/pullquote block edit matches snapshot 1`] = ` -
-
-
-
-
- -
-
-
-
-`; diff --git a/packages/block-library/src/pullquote/test/index.js b/packages/block-library/src/pullquote/test/index.js deleted file mode 100644 index 24e135dd4c02c..0000000000000 --- a/packages/block-library/src/pullquote/test/index.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Internal dependencies - */ -import { name, settings } from '../'; -import { blockEditRender } from '../../test/helpers'; - -describe( 'core/pullquote', () => { - test( 'block edit matches snapshot', () => { - const wrapper = blockEditRender( name, settings ); - - expect( wrapper ).toMatchSnapshot(); - } ); -} ); diff --git a/packages/block-library/src/pullquote/theme.scss b/packages/block-library/src/pullquote/theme.scss deleted file mode 100644 index 3d1d40647f496..0000000000000 --- a/packages/block-library/src/pullquote/theme.scss +++ /dev/null @@ -1,12 +0,0 @@ -.wp-block-pullquote { - border-top: 4px solid $dark-gray-500; - border-bottom: 4px solid $dark-gray-500; - color: $dark-gray-600; - - cite, - footer { - color: $dark-gray-600; - text-transform: uppercase; - font-size: $default-font-size; - } -} diff --git a/packages/block-library/src/style.scss b/packages/block-library/src/style.scss index 9d6115f8d76d7..d34b95129e7a5 100644 --- a/packages/block-library/src/style.scss +++ b/packages/block-library/src/style.scss @@ -12,7 +12,6 @@ @import "./latest-comments/style.scss"; @import "./latest-posts/style.scss"; @import "./paragraph/style.scss"; -@import "./pullquote/style.scss"; @import "./quote/style.scss"; @import "./separator/style.scss"; @import "./subhead/style.scss"; diff --git a/packages/block-library/src/theme.scss b/packages/block-library/src/theme.scss index da6419fcf4701..bd7affa534379 100644 --- a/packages/block-library/src/theme.scss +++ b/packages/block-library/src/theme.scss @@ -1,7 +1,5 @@ @import "./code/theme.scss"; @import "./preformatted/theme.scss"; -@import "./pullquote/theme.scss"; -@import "./quote/theme.scss"; @import "./separator/theme.scss"; @import "./table/theme.scss"; @import "./video/theme.scss"; diff --git a/packages/editor/src/store/selectors.js b/packages/editor/src/store/selectors.js index a1edb8e88149a..15e836b31a034 100644 --- a/packages/editor/src/store/selectors.js +++ b/packages/editor/src/store/selectors.js @@ -1353,8 +1353,6 @@ export function getSuggestedPostFormat( state ) { case 'core/image': return 'image'; case 'core/quote': - case 'core/pullquote': - return 'quote'; case 'core/gallery': return 'gallery'; case 'core/video': diff --git a/phpunit/fixtures/long-content.html b/phpunit/fixtures/long-content.html index 07677c3906437..6492faadfa517 100644 --- a/phpunit/fixtures/long-content.html +++ b/phpunit/fixtures/long-content.html @@ -107,12 +107,6 @@

Media Rich

You can build any block you like, static or dynamic, decorative or plain. Here's a pullquote block:

- -
-

Code is Poetry

-The WordPress community -
-

If you want to learn more about how to build additional blocks, or if you are interested in helping with the project, head over to the GitHub repository.

diff --git a/post-content.php b/post-content.php index fef557c7ccd44..8f217a5345827 100644 --- a/post-content.php +++ b/post-content.php @@ -139,10 +139,6 @@

- -

- -

diff --git a/test/integration/full-content/fixtures/core__pullquote.html b/test/integration/full-content/fixtures/core__pullquote.html deleted file mode 100644 index 8c13cedfe000d..0000000000000 --- a/test/integration/full-content/fixtures/core__pullquote.html +++ /dev/null @@ -1,5 +0,0 @@ - -

-

Testing pullquote block...

...with a caption -
- diff --git a/test/integration/full-content/fixtures/core__pullquote.json b/test/integration/full-content/fixtures/core__pullquote.json deleted file mode 100644 index 11d576614228c..0000000000000 --- a/test/integration/full-content/fixtures/core__pullquote.json +++ /dev/null @@ -1,26 +0,0 @@ -[ - { - "clientId": "_clientId_0", - "name": "core/pullquote", - "isValid": true, - "attributes": { - "value": [ - { - "children": { - "type": "p", - "props": { - "children": [ - "Testing pullquote block..." - ] - } - } - } - ], - "citation": [ - "...with a caption" - ] - }, - "innerBlocks": [], - "originalContent": "
\n

Testing pullquote block...

...with a caption\n
" - } -] diff --git a/test/integration/full-content/fixtures/core__pullquote.parsed.json b/test/integration/full-content/fixtures/core__pullquote.parsed.json deleted file mode 100644 index c8d7f7c3c2dd6..0000000000000 --- a/test/integration/full-content/fixtures/core__pullquote.parsed.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "blockName": "core/pullquote", - "attrs": null, - "innerBlocks": [], - "innerHTML": "\n
\n

Testing pullquote block...

...with a caption\n
\n" - }, - { - "attrs": {}, - "innerHTML": "\n" - } -] diff --git a/test/integration/full-content/fixtures/core__pullquote.serialized.html b/test/integration/full-content/fixtures/core__pullquote.serialized.html deleted file mode 100644 index 00f47cf0d5e39..0000000000000 --- a/test/integration/full-content/fixtures/core__pullquote.serialized.html +++ /dev/null @@ -1,3 +0,0 @@ - -

Testing pullquote block...

...with a caption
- diff --git a/test/integration/full-content/fixtures/core__pullquote__multi-paragraph.html b/test/integration/full-content/fixtures/core__pullquote__multi-paragraph.html deleted file mode 100644 index 252b029f1f888..0000000000000 --- a/test/integration/full-content/fixtures/core__pullquote__multi-paragraph.html +++ /dev/null @@ -1,7 +0,0 @@ - -
-

Paragraph one

-

Paragraph two

- by whomever -
- diff --git a/test/integration/full-content/fixtures/core__pullquote__multi-paragraph.json b/test/integration/full-content/fixtures/core__pullquote__multi-paragraph.json deleted file mode 100644 index 266568fa51bc0..0000000000000 --- a/test/integration/full-content/fixtures/core__pullquote__multi-paragraph.json +++ /dev/null @@ -1,44 +0,0 @@ -[ - { - "clientId": "_clientId_0", - "name": "core/pullquote", - "isValid": true, - "attributes": { - "value": [ - { - "children": { - "type": "p", - "props": { - "children": [ - "Paragraph ", - { - "type": "strong", - "props": { - "children": [ - "one" - ] - } - } - ] - } - } - }, - { - "children": { - "type": "p", - "props": { - "children": [ - "Paragraph two" - ] - } - } - } - ], - "citation": [ - "by whomever" - ] - }, - "innerBlocks": [], - "originalContent": "
\n

Paragraph one

\n

Paragraph two

\n by whomever\n
" - } -] diff --git a/test/integration/full-content/fixtures/core__pullquote__multi-paragraph.parsed.json b/test/integration/full-content/fixtures/core__pullquote__multi-paragraph.parsed.json deleted file mode 100644 index 2a816764b3ae4..0000000000000 --- a/test/integration/full-content/fixtures/core__pullquote__multi-paragraph.parsed.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "blockName": "core/pullquote", - "attrs": null, - "innerBlocks": [], - "innerHTML": "\n
\n

Paragraph one

\n

Paragraph two

\n by whomever\n
\n" - }, - { - "attrs": {}, - "innerHTML": "\n" - } -] diff --git a/test/integration/full-content/fixtures/core__pullquote__multi-paragraph.serialized.html b/test/integration/full-content/fixtures/core__pullquote__multi-paragraph.serialized.html deleted file mode 100644 index 635df56edcf4f..0000000000000 --- a/test/integration/full-content/fixtures/core__pullquote__multi-paragraph.serialized.html +++ /dev/null @@ -1,3 +0,0 @@ - -

Paragraph one

Paragraph two

by whomever
-