From 2f9696a000a79cd0cf7df695be039969d5e6a6b2 Mon Sep 17 00:00:00 2001 From: Angus MacIsaac Date: Fri, 13 Sep 2024 19:00:52 -0300 Subject: [PATCH] Swallow getLayoutMap() error (#2790) * Fix getLayoutMap() bug * Update CHANGELOG.md --------- Co-authored-by: Angus Co-authored-by: Peter --- docs/CHANGELOG.md | 1 + src/components/utils/keyboard.ts | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index eacada6d..5c50865e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -3,6 +3,7 @@ ### 2.30.6 – `Fix` – Fix the display of ‘Convert To’ near blocks that do not have the ‘conversionConfig.export’ rule specified +– `Fix` – The Plus button does not appear when the editor is loaded in an iframe in Chrome ### 2.30.5 diff --git a/src/components/utils/keyboard.ts b/src/components/utils/keyboard.ts index 62586d57..65d8e614 100644 --- a/src/components/utils/keyboard.ts +++ b/src/components/utils/keyboard.ts @@ -47,8 +47,15 @@ export async function getKeyboardKeyForCode(code: string, fallback: string): Pro return fallback; } - const map = await keyboard.getLayoutMap(); - const key = map.get(code); + try { + const map = await keyboard.getLayoutMap(); - return key || fallback; + const key = map.get(code); + + return key || fallback; + } catch (e) { + console.error(e); + + return fallback; + } }