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 to heading transformation. #5088

Merged
merged 1 commit into from
Feb 16, 2018

Conversation

jorgefilipecosta
Copy link
Member

Description

Fixes: #5052

This PR corrects the logic of quote to heading transform.
The logic is now the following:
If no citation and no content exist an empty heading is created.
If citation exists but content does not exist a heading is created with citation as the content.
In other citations the first paragraph of the quote is transformed into and heading and new quote is created equal to the original but with the first paragraph removed. If the quote just contains one paragraph the new quote will contain just the citation.

How Has This Been Tested?

Use transformations from quote to heading and verify the logic specified above is working correctly.

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

I had a JavaScript error by doing quote => heading => quote. Is it related? can we fix it as well?

@jorgefilipecosta jorgefilipecosta force-pushed the fix/quote-heading-transforms branch 2 times, most recently from e8e0763 to f0d1ca9 Compare February 16, 2018 12:35
@jorgefilipecosta
Copy link
Member Author

I had a JavaScript error by doing quote => heading => quote. Is it related? can we fix it as well?

I was able to replicate the problem 👍 , it should be fixed now.


return [ text, quote ];
const headingContent = castArray( isString( get( value, [ 0, 'children' ] ) ) ?
Copy link
Contributor

Choose a reason for hiding this comment

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

should we extract this value, [ 0, 'children' ] to a variable? it seems used three times here?

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.

I feel like we fixed this bug several times, some testing for these interactions would be good.

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.

2 participants