signavio / react-mentions

@mention people in a textarea
https://react-mentions.vercel.app
Other
2.47k stars 573 forks source link

Fixed native undo/redo #676

Closed byTimo closed 1 year ago

byTimo commented 1 year ago

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

Steps to reproduce:

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[bot] commented 1 year ago

🦋 Changeset detected

Latest commit: 87b8fa7b8a762a8cdae7998ea1f66cff7addd980

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[bot] commented 1 year ago

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