-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Conversation
There was a problem hiding this 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 ) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
ade00a2
to
bd6776a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice fix. :)
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: