mdx-editor / mdx-editor/editor
[BUG] Undo/Redo Stack shared between multiple editor instances
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.7k
- Forks
- 307
- Avg merge
- 14h 22m
- Merged PRs (30d)
- 5
Description
If you want to ask for support or request features, sponsor the project and contact me over email.
- I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
- I have read the documentation and cannot find an answer.
Describe the bug
If two or more instances of the editor are used and content has been created in them, when undo/redo is called in one editor, undo/redo is also performed in the other editors when all changes have been completed in the current editor.
Reproduction
https://codesandbox.io/p/sandbox/mdx-editor-base-forked-r7vynx
To Reproduce
Steps to reproduce the behavior:
- Create two or more editor instances
- Create content in each of them
- Undo/redo all changes in one of them and keep doing undo/redo (either with shortcut or with the button in the toolbar)
- See undo/redo applied to the other editor as well
Expected behavior
Undo/redo only applies to the content of the editor, where it was called.
Video
https://github.com/user-attachments/assets/c775203b-466c-4d3f-a760-63a4e5b09adf
Desktop
- OS: Windows
- Browser: Chrome
- Stack: Next.js App-Router
Additional context
I went back to version 2.0 and the error still occurred. Only when I switched to version 1.* did undo/redo only apply to the content of the editor to which it belongs.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the linked CodeSandbox using two editor instances, then trace the undo/redo handling used by the editor and toolbar. Done means undo and redo in one instance never alter another instance, including when keyboard shortcuts are used, with a regression test covering multiple editors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100