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

Pressing Ctrl+Z in an editor with unchanged content removes the content #4516

Open
philiphendry opened this issue Dec 4, 2024 · 1 comment

Comments

@philiphendry
Copy link

If the editor is loaded and initialised with content then if, I give the editor focus and press Ctrl+Z, then the initial content is removed (presumably "undone" even though no changes were made.) This is confusing behaviour for a user if they have been making changes as they'll undo their own work but then see everything vanish.

Steps for Reproduction

  1. Visit https://quilljs.com/playground/react or https://quilljs.com/playground/react
  2. Step Two: give focus to the editor
  3. Step Three: Press Ctrl+Z

Expected behavior:

The initial content of the editor should remain and not be removed when pressing Ctrl + Z.

Actual behavior:

The initial content is removed.

Platforms:

Windows 11 Version 23H2 (OS Build 22631.4460)
Firefox 133.0
Edge 131.0.2903.70

Version:

Run Quill.version to find out
2.0.3 (at the time of accessing the playground pages)

@helgeFox
Copy link

helgeFox commented Dec 5, 2024

Maybe the example should have had a line added to it. In the Editor.js file try adding this: quill.history.clear(); just after the initial content is set.

It should look like this just after Quill is instantiated

if (defaultValueRef.current) {
  quill.setContents(defaultValueRef.current);
  quill.history.clear();
}

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

No branches or pull requests

2 participants