From a6b606d804795d9b134784a35e3b00ac77f3ebbc Mon Sep 17 00:00:00 2001 From: Ben Wormald Date: Fri, 30 Jun 2023 08:04:48 +0100 Subject: [PATCH] update hotkeys util to use isHotkey (#5462) --- .changeset/many-cows-add.md | 5 +++++ packages/slate-react/src/utils/hotkeys.ts | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .changeset/many-cows-add.md diff --git a/.changeset/many-cows-add.md b/.changeset/many-cows-add.md new file mode 100644 index 000000000..4e6e537d0 --- /dev/null +++ b/.changeset/many-cows-add.md @@ -0,0 +1,5 @@ +--- +'slate-react': patch +--- + +Update hotkeys util to use isHotkey for better support for non-latin keyboards diff --git a/packages/slate-react/src/utils/hotkeys.ts b/packages/slate-react/src/utils/hotkeys.ts index 65de16d68..c4efaeb47 100644 --- a/packages/slate-react/src/utils/hotkeys.ts +++ b/packages/slate-react/src/utils/hotkeys.ts @@ -1,4 +1,4 @@ -import { isKeyHotkey } from 'is-hotkey' +import { isHotkey } from 'is-hotkey' import { IS_APPLE } from './environment' /** @@ -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