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 deleting backwards when there are only inlines #2850

Closed
wants to merge 2 commits into from

Conversation

North101
Copy link

@North101 North101 commented Jun 3, 2019

This is a fix for #2621.

The bug happens when there are no text nodes between the cursor and the start of the document.

Is this adding or improving a feature or fixing a bug?

Fixing a bug

What's the new behavior?

Deletes an inline without erroring.

How does this change work?

If the previous node is an Inline, the focus offset is 0 and the text value of the inline is empty, then the inline is deleted.

Have you checked that...?

  • [YES] The new code matches the existing patterns and styles.
  • [YES] The tests pass with yarn test.
  • [YES] The linter passes with yarn lint. (Fix errors with yarn prettier.)
  • [YES] The relevant examples still work. (Run examples with yarn watch.)

Does this fix any issues or need any specific reviewers?

Fixes: #2621

// If the next sibling is an inline, has no text and the focus offset is 0,
// then delete the inline
if (
traversed === 0 &&
Copy link
Contributor

Choose a reason for hiding this comment

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

would you want to refactor this compound conditional to its own method? something like 'shouldDeleteInline'

@ianstormtaylor
Copy link
Owner

Fixed by #3093.

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.

Deleting Inline at beginning of editor causes error.
3 participants