Skip to content

Commit

Permalink
update hotkeys util to use isHotkey (#5462)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Wormald committed Jun 30, 2023
1 parent 711c229 commit a6b606d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/many-cows-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'slate-react': patch
---

Update hotkeys util to use isHotkey for better support for non-latin keyboards
8 changes: 4 additions & 4 deletions packages/slate-react/src/utils/hotkeys.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isKeyHotkey } from 'is-hotkey'
import { isHotkey } from 'is-hotkey'
import { IS_APPLE } from './environment'

/**
Expand Down Expand Up @@ -53,9 +53,9 @@ const create = (key: string) => {
const generic = HOTKEYS[key]
const apple = APPLE_HOTKEYS[key]
const windows = WINDOWS_HOTKEYS[key]
const isGeneric = generic && isKeyHotkey(generic)
const isApple = apple && isKeyHotkey(apple)
const isWindows = windows && isKeyHotkey(windows)
const isGeneric = generic && isHotkey(generic)
const isApple = apple && isHotkey(apple)
const isWindows = windows && isHotkey(windows)

return (event: KeyboardEvent) => {
if (isGeneric && isGeneric(event)) return true
Expand Down

0 comments on commit a6b606d

Please sign in to comment.