Skip to content

Commit

Permalink
Changed event.code to event.key
Browse files Browse the repository at this point in the history
• With AZERTY keyboard for example, event.code contains « KeyW » on the Z key
• This fix ensure compatibility for CTRL+Z/CTRL+SHIFT+Z on all keyboards
  • Loading branch information
GitHubAccount8 authored and antonmedv committed Oct 9, 2020
1 parent 766977d commit d88a7a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions codejar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,11 @@ export function CodeJar(editor: HTMLElement, highlight: (e: HTMLElement) => void
}

function isUndo(event: KeyboardEvent) {
return isCtrl(event) && !event.shiftKey && event.code === "KeyZ"
return isCtrl(event) && !event.shiftKey && event.key === "z"
}

function isRedo(event: KeyboardEvent) {
return isCtrl(event) && event.shiftKey && event.code === "KeyZ"
return isCtrl(event) && event.shiftKey && event.key === "z"
}

function insert(text: string) {
Expand Down

0 comments on commit d88a7a2

Please sign in to comment.