Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed quote paragraph transformations. #3802

Merged
merged 1 commit into from Dec 5, 2017

Conversation

jorgefilipecosta
Copy link
Member

@jorgefilipecosta jorgefilipecosta commented Dec 4, 2017

This PR aims to fix issues #3559 and #1765 affecting quote->paragraph transformations.
Before when transforming a quote into a paragraph the result was a paragraph and the remaining a quote. Now the quote is transformed into several paragraphs. The logic was also simplified.
The strategy used in this PR is identical to the one used to transform between quote and list.

How Has This Been Tested?

Follow the steps described in both issues and verify both are now resolved.
Add an empty a quote verify it transforms to empty paragraph
Add a quote with one line of text verify it transforms to one paragraph.
Add a quote with a citation verify it transforms to one paragraph.
Add a quote with many lines and custom formats (e.g bold links etc...) verify it transforms each line to a paragraph the citation if present is the last paragraph.

Screenshots:

dec-04-2017 15-05-40

@jorgefilipecosta jorgefilipecosta added [Feature] Blocks Overall functionality of blocks [Type] Bug An existing feature does not function as intended labels Dec 4, 2017
@jorgefilipecosta jorgefilipecosta self-assigned this Dec 4, 2017
Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment, but this works great 👍

} );
transform: ( { value, citation } ) => {
// transforming an empty quote
if ( ( ! value || ! value.length ) && ! citation ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're checking ! value here which means the value could be undefined. Should we check the same when we use value.map down here, or maybe just replace it with map?

unless value is always an array and this first check is unnecessary then?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch @youknowriad, I also checked for undefined/null on the map.

Before when transforming a quote into a paragraph the result was a a paragraph and the remaining quote. Now the quote is transformed into several paragraphs. The logic was also simplified.
Copy link
Contributor

@mcsf mcsf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants