From 6a95c0e4ffe97d110b9a712ebb813625f6e0f66f Mon Sep 17 00:00:00 2001 From: JensLincke Date: Thu, 2 May 2024 15:21:41 +0200 Subject: [PATCH] fix Alt_[ for german MacOS SQUASHED: AUTO-COMMIT-src-client-lively.js,AUTO-COMMIT-src-components-widgets-lively-code-mirror-modes.js, --- src/client/lively.js | 5 +++++ src/components/widgets/lively-code-mirror-modes.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/client/lively.js b/src/client/lively.js index e0c9ca5da..39763783e 100644 --- a/src/client/lively.js +++ b/src/client/lively.js @@ -1985,6 +1985,11 @@ export default class Lively { var shadowRoot = this.findParentShadowRoot(element) if (shadowRoot) return shadowRoot.host } + + static isMacOS() { + return /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform); + } + static isActiveElement(element) { var activeElemnt = this.activeElement(); diff --git a/src/components/widgets/lively-code-mirror-modes.js b/src/components/widgets/lively-code-mirror-modes.js index 3eb2699b7..3c087b449 100644 --- a/src/components/widgets/lively-code-mirror-modes.js +++ b/src/components/widgets/lively-code-mirror-modes.js @@ -274,7 +274,7 @@ class CodeMirrorModes { } // #KeyboardShortcut Alt-[ used in container to manipulate navbar - if (evt.key === '[' && (evt.altKey && !evt.ctrlKey && !evt.shiftKey)) { + if (evt.key === '[' && (evt.altKey && !evt.ctrlKey && !evt.shiftKey) && !lively.isMacOS()) { evt.preventDefault(); evt.codemirrorIgnore = true; }