Ctrl+Z does not undo my previous step

AI-generated summary

The discussion revolves around the issue of Ctrl+Z not undoing the previous step in the Discourse editor, instead clearing the entire textarea. wuchong and uwe_keim reported this behavior. codinghorror explained that this is browser and OS specific, and not a Discourse-specific issue. JSey suggested that the browser interprets both user input and editor actions as input, causing the undo to clear everything. codinghorror mentioned that pressing Ctrl+Y can redo the undo. However, integrating undo functionality into the Discourse editor, as suggested by JSey, is considered a huge piece of work with limited effect. sam mentioned that implementing custom undo functionality in the past caused more problems than it solved.

When I type something in the textarea , and select all, and ctrl+b ,and ctrl+z.

I just want to undo my ctrl+b step, however it completely my textarea. I have to type the content again.

It is weird the ctrl+z means clearing textarea instead of undo.

This is 100% browser and OS specific, we do not override the default browser text box handling of these keys. You can experiment here:

Take http://codepen.io/anon/pen/uryJl which contains a plain html text box.

In different web browsers, type in

test line one
test line two
test line three

And then try ctrl+z.

Depends on the browser and whether you naturally pause or not when typing. Play with it and see.

1개의 좋아요

Combo Ctrl + Z does work. But if you apply click on any button on composer’s toolbar (or call it via combo key), it doesn’t work.

Press ctrl+y to redo the undo if that is the case. You do not have to re type the content…

I think what they want to say is that the editor does not distinguish between typed user input and editor actions like Ctrl-B, Ctrl-R etc. The browser interprets all this as input and if you say “undo”, it does that: it undos all user input, including typed text and Ctrl-keypresses. This, however, is general behaviour of browsers - any browser-based web app behaves this way.

The only solution I see here would be to integrate the undo functionality into the Discourse editor - but this seems like a huge piece of work for a very limited effect - I personally never missed this, neither in Discourse, nor in other forum software…

2개의 좋아요

We used to do that, and it just cause a lot of pain and confusion.

3개의 좋아요

Just installed the latest upgrade that fixes “Keyboard shortcuts not working anymore”.

Now it behaves like this:

  • When I press Ctrl+B it makes the selected text bold.
  • When I press Ctrl+Z (undo) nothing happens. I.e. the bold text stays bold.

Is this the correct/expected behaviour?

Yes, bolding works but undo is disabled.

1개의 좋아요