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

List Block: fix merging with indented list items #17845

Merged
merged 2 commits into from
Oct 9, 2019

Conversation

ellatrix
Copy link
Member

@ellatrix ellatrix commented Oct 8, 2019

Description

Fixes #17843. The problem is that create is missing the multilineWrapperTags argument when using it with an (indented) list. This needs to be provided in the attribute definition. Since lists are kind of a strange case, I've added the key as unstable. Ideally, in the future, we use blocks for each list item.

How has this been tested?

See #17843 and the e2e test case I've added.

Screenshots

Types of changes

Bug fix.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

@ellatrix ellatrix added [Type] Bug An existing feature does not function as intended [Block] List Affects the List Block [Package] Block editor /packages/block-editor labels Oct 8, 2019
@ellatrix ellatrix added this to the Gutenberg 6.7 milestone Oct 8, 2019
@ellatrix ellatrix requested a review from mcsf October 8, 2019 13:16
@mcsf
Copy link
Contributor

mcsf commented Oct 8, 2019

Thanks!

This fixes it for me when using Backspace from the second List, but not when using Delete from the first one. At least on Safari, macOS.

@ellatrix
Copy link
Member Author

ellatrix commented Oct 8, 2019

@mcsf Oops, forgot that there are two create calls, for each block. Should be fixed now.

@ellatrix
Copy link
Member Author

ellatrix commented Oct 8, 2019

Introduced in #14640, which I don't think was included in WP 5.2.

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.

Thanks for the quick fix! Works well for me.

Where do you see __unstableMultilineWrapperTags going in the future? Do we need a follow-up issue to revise? I ask only because it's introducing a hidden interface, but as far as the fix goes it looks good to merge.

@ellatrix
Copy link
Member Author

ellatrix commented Oct 9, 2019

@mcsf I see it as something special that is only needed for nested lists and shouldn't be needed for other blocks. In addition, I think we'd like to revise the list block in the future to use nested block and one rich text instance per item.

Since lists are kind of a strange case, I've added the key as unstable. Ideally, in the future, we use blocks for each list item.

@ellatrix
Copy link
Member Author

ellatrix commented Oct 9, 2019

Thanks for the review!

@ellatrix
Copy link
Member Author

ellatrix commented Oct 9, 2019

To be honest, I wish we had done the same for multiline, but it's been around for a long time... It you think it's better to remove the __unstable prefix, I'm fine with that.

@mcsf
Copy link
Contributor

mcsf commented Oct 9, 2019

To be honest, I wish we had done the same for multiline, but it's been around for a long time... It you think it's better to remove the __unstable prefix, I'm fine with that.

No, I think it's better to keep the prefix!

@ellatrix ellatrix merged commit ebc71b1 into master Oct 9, 2019
@ellatrix ellatrix deleted the fix/list-merge-indented branch October 9, 2019 10:00
gziolo pushed a commit that referenced this pull request Oct 15, 2019
* List Block: fix merging with indented list items

* Fix forward merge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] List Affects the List Block [Package] Block editor /packages/block-editor [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

List: Merging lists erroneously joins indented items
2 participants