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 native undo/redo #676

Merged
merged 4 commits into from
Jun 29, 2023
Merged

Fixed native undo/redo #676

merged 4 commits into from
Jun 29, 2023

Conversation

byTimo
Copy link
Contributor

@byTimo byTimo commented May 24, 2023

The fix for native undo/redo (only a plain text) in case the input was not focused before the operation.

Steps to reproduce:

  • input any text to MentionInput
  • focus something else
  • press ctrl+z/cmd+z

Screen Cast 2023-05-24 at 5 32 57 PM

Technically, the problem happens, because for such undo/redo operations onChange handler is called before onSelect, hence this.state.selectionStart and this.state.selectionEnd are null and the next value is calculated incorrectly, based on what there was before the operation and the value that should be set after one

@changeset-bot
Copy link

changeset-bot bot commented May 24, 2023

🦋 Changeset detected

Latest commit: 87b8fa7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
react-mentions Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented May 24, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-mentions ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 29, 2023 0:18am

Copy link
Collaborator

@Sigrsig Sigrsig left a comment

Choose a reason for hiding this comment

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

Approved, thanks for your contribution 👍

@Sigrsig Sigrsig merged commit 4ef52dd into signavio:master Jun 29, 2023
3 checks passed
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.

2 participants