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

Quotes: Fix handling of insertion and removal of empty lines. #1082

Merged
merged 7 commits into from
Jun 6, 2019

Conversation

SergioEstevao
Copy link
Contributor

@SergioEstevao SergioEstevao commented Jun 5, 2019

Fixes #207

Relate GB PR: WordPress/gutenberg#16013

This PR fixes the following issues around the insertion and removal of empty lines inside quotes:

  • It was impossible to insert multiple empty lines inside a quote block
  • After the insertion of an empty line at the end of the quote block, trying to remove it caused a crash or the merge of the block with the block above.

The main changes are the following:

  • Aztec is updated in order that empty block elements are not removed. So when entering a new line in quote that results in this HTML: <p></p> isn't remove by Aztec
  • Checks are done in GB JS code to check if the selection range returned by iOS is inside the text length in the format structure. This could happen in scenarios where extra characters were added by Aztec in order to display paragraph styles in the last line.

To test:

  • Open the demo app
  • Select a quote block
  • Add a new line to the end of content on the quote part
  • Add another line, make sure it shows up
  • Try to delete both lines
  • Check that no crash or unnecessary merge happens.

Know issues :

  • When adding a new line to the end of quote, an extra line is added, this is because Aztec iOS adds an extra line in order to keep the paragraph.
  • When adding a brand new quote the quote part will have immediately a new line and the placeholder text will not be show.

I know the issues above are not ideal, but I think they are better than having the crash on removal, or not having the possibility of adding multiple empty lines inside the quote.

Update release notes:

  • If there are user facing changes, I have added an item to RELEASE-NOTES.txt.

@SergioEstevao SergioEstevao added this to the v1.7 milestone Jun 5, 2019
@SergioEstevao SergioEstevao requested a review from koke June 5, 2019 22:15
@SergioEstevao SergioEstevao changed the title Issue/207 quote removal of line Quotes: Fix handling of insertion and removal of empty lines. Jun 5, 2019
@koke
Copy link
Member

koke commented Jun 6, 2019

I tried this:

  • Create a new post
  • Add a quote
  • Write a couple words and press enter, a new line inside quote is created
  • Tap backspace, nothing happens

@koke
Copy link
Member

koke commented Jun 6, 2019

Ok, I had not realized I had to update Aztec for testing, the previous case works well.

I found a new issue, but I don't think we need to block on this one, we can handle it separately:

  1. Add a quote
  2. Write a few words
  3. Press enter, it adds a new line
  4. Press enter again, nothing happens

Copy link
Member

@koke koke left a comment

Choose a reason for hiding this comment

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

I've tested this and it works fine, although I'm not sure I understand the code changes well enough, you might want a second set of eyes on those.

@SergioEstevao SergioEstevao merged commit 9bcf853 into develop Jun 6, 2019
@SergioEstevao SergioEstevao deleted the issue/207_quote_removal_of_line branch June 6, 2019 11:07
@SergioEstevao SergioEstevao restored the issue/207_quote_removal_of_line branch June 6, 2019 11:07
@SergioEstevao SergioEstevao deleted the issue/207_quote_removal_of_line branch June 6, 2019 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quote block
2 participants