fastmail / Squire

The rich text editor for arbitrary HTML.
MIT License
4.77k stars 406 forks source link

Undo/ Redo does not reset the cursor position #445

Closed paulflo150 closed 12 months ago

paulflo150 commented 1 year ago

Calling undo or redo does not set the cursor position, like the other commands do.

Is this the expected behavior?

neilj commented 1 year ago

Sorry, I'm not quite sure what you mean by this — undo/redo does restore the cursor position.

paulflo150 commented 1 year ago

Hello @neilj, I created a stackblitz based on the demo provided, and when I click undo or redo the editor does not regain focus like it does for the other commands.

https://stackblitz.com/edit/web-platform-altctd?file=index.html

Does that make sense or am I looking at it wrong?

neilj commented 1 year ago

That seems to be behaving as I expect. Can you please provide:

  1. Exact steps to reproduce.
  2. What happened.
  3. What you expected to happen.
paulflo150 commented 1 year ago

What I would expect is for the editor to become active again after I click undo or redo, just like it happens with bold for instance.

For instance:

  1. Type in "test test".
  2. Click the Undo button.
  3. Without reactivating the editor via mouse/ keyboard I should be able to continue typing, but I cannot because the editor does not appear to automatically regain focus.

This works perfectly fine if I use CTRL Z, but not if I use the button.

It also works when clicking on the Bold button: replace step 2 above with clicking on Bold.

https://github.com/fastmail/Squire/assets/8136504/31bc426d-1212-481a-bf85-3b3861de2405

Once I clicked on Bold the editor is automatically reactivated and I can continue typing without any mouse or keyboard interaction.

I hope this makes sense.

neilj commented 1 year ago

Oh I see, I missed you were clicking a button rather than using the keyboard shortcut. Right, yes I agree that should focus, that's easy.

paulflo150 commented 1 year ago

That sounds great, thank you!