kommitters / editorjs-undo

Undo/Redo feature for Editor.js
https://www.npmjs.com/package/editorjs-undo
MIT License
169 stars 51 forks source link

Undo/Redo on German Keyboard Layout not working #213

Closed Lightwight closed 1 year ago

Lightwight commented 1 year ago

Precheck

Description

Undo/Redo does not work on german keyboard layout. Both gets triggered if i press CTRL+Z or CTRL+Y. This is because of the letter "Y" and "Z" is switched on german keyboard layout. In your code you are using "e.code" to determine the pressed keyboard combination which shouldn't be used according the specs: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code

Environment

Current behavior

  1. Switch to german keyboard layout
  2. type something into a paragraph block.
  3. press Ctrl+z.

Result: Nothing happens (behind the scences the undo-eventlistener gets fired and then the redo-eventlistener)

Expected behavior

Support of german keyboard layout which means the check by "e.code" should be removed.

juanmagiraldor commented 1 year ago

Hello! We just released v2.0.23 which includes the fix for this issue! Thank you @Lightwight for making this contribution 👏🏻