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

fix(block-events): caret losing after backspace after nested list #2723

Merged
merged 5 commits into from
May 23, 2024

Conversation

neSpecc
Copy link
Member

@neSpecc neSpecc commented May 21, 2024

Problem

Pressing backspace at the start of a paragraph after a Nested List causes the caret to be lost.

caret-bug.mov

Cause

There are two problems:

  1. The backspace handler incorrectly shows true for areBlockMergeable(). This was due to confused arguments: the first argument is the block to merge into, and the second is the block to merge from. After fixing this, areBlockMergeable() will return false.

  2. The Nested List tool has a conversionConfig but lacks a merge() method, making it not mergeable. This case was not covered by tests, so I've added the corresponding test case.

  3. During debugging, I noticed that creating/restoring the Shadow caret did not work for Nested Lists. Previously, it added a Shadow caret to pluginContent, which is complex for Nested Lists, and it was added to a wrong place.

Solution

  1. Fixed the order of arguments for areBlockMergeable().
  2. Changed the argument of createShadow() from pluginContent to lastInput, so the shadow caret is now set properly. Although with the fix №1 this logic won't be called, but I've fixed it anyway.
caret-bug-fixed.mov

And then I'm gonna update the Nested List tool adding a merge() method in there. After that the merging will start working instead of caret moving.

@neSpecc neSpecc merged commit 29d68ec into next May 23, 2024
6 checks passed
@neSpecc neSpecc deleted the fix-backspace-merge branch May 23, 2024 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants