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

Overwrite context menu and browser menu undo/redo #588

Closed
ripper17 opened this issue Feb 22, 2016 · 3 comments
Closed

Overwrite context menu and browser menu undo/redo #588

ripper17 opened this issue Feb 22, 2016 · 3 comments

Comments

@ripper17
Copy link

If you write text into the quill editor, undoing / redoing the changes works unreliable when called from the context menu or the browser-menu. Tested in FF 44.0.2, Opera 35.0, Chromium 48.0, InternetExplorer 11.

Steps to reproduce:
1.) Clean Quill editor on demo page (not strictly necessary, just easier to see the result)
2.) Enter some text, best with a couple of line breaks
3.) Undo the last insert with keyboard shortcut (!) (i.e. CTRL+Z)
4.) Undo the second-to-last insert with context-menu (right mouse button) or from the application menu (often in menu "Edit")

Expected behaviour:
The undo from the browser should undo the second-to-last insert

Actual result:
The undo from the browser has no effect. The next undo from the browser sometimes works, depending on the browser: in FF it doesn't seem to work, other browser are handling this better.

If you switch between the two methods (keyboard shortcut and browser-menu-based undo) the result is very varying. Sometimes a few lines get undone (or redone) but not necessarily in the correct order, sometimes a redo from using the keyboard shortcut remains and previous changes get undone. Many line breaks remain in the editor when using the undo from the browser. Play around with undo / redo by shortcut and then note how the browser-undo/-redo does some weird stuff (a little dependant on the browser, but all I've tested are doing it "wrong")

Using CTRL+Z only works as expected in all cases I have tested so far.

Note: this does not happen on a "normal" contenteditable, see https://jsfiddle.net/jd3rgr0g/2/

Possibly related issue: #413
Possibly not related issues (even though they have to do with undo): #15 , #229 , #231

@jhchen
Copy link
Member

jhchen commented Feb 22, 2016

I believe this is an issue affecting all rich text editors utilizing contenteditable. If you do anything special, which most editors do, the native undo manager gets confused. There are some proposals to add an API so rich text editors can tell the browser what to do but this is currently not available as a web standard. The workaround is to disable the native undo/stack so it at least does not do the wrong thing. This is probably be how Quill will have to address the problem as well.

@jhchen jhchen added this to the Quill 1.0 milestone Feb 22, 2016
@jhchen jhchen changed the title Browser-internal "undo" / "redo" is unreliable Overwrite context menu and browser menu undo/redo Aug 19, 2016
@jhchen jhchen removed this from the Quill 1.0 milestone Aug 19, 2016
@ivanalejandro0
Copy link

Here's a relevant discussion about contenteditable and undo/redo: w3c/editing#150

@quill-bot
Copy link

Quill 2.0 has been released (announcement post) with many changes and fixes. If this is still an issue please create a new issue after reviewing our updated Contributing guide 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants