From 17bcfe5257d4c94ea3218e946c3fd21033f836f8 Mon Sep 17 00:00:00 2001 From: Jeff Sandberg Date: Sun, 2 Jul 2023 04:11:09 -0600 Subject: [PATCH] Add metaKey to markdown-textarea, for macos MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit On MacOS, Ctrl is less commonly used than Command (⌘). Javascript expresses command as `metaKey`. This allows for _either_ Ctrl or Command to be used in the Markdown text area. Note that on Windows, on some browsers, the "windows" key is labeled as meta, so it would work on windows as well. http://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/metaKey --- src/shared/components/common/markdown-textarea.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/components/common/markdown-textarea.tsx b/src/shared/components/common/markdown-textarea.tsx index 5623ace..29075b9 100644 --- a/src/shared/components/common/markdown-textarea.tsx +++ b/src/shared/components/common/markdown-textarea.tsx @@ -473,7 +473,7 @@ export class MarkdownTextArea extends Component< // Keybind handler // Keybinds inspired by github comment area handleKeyBinds(i: MarkdownTextArea, event: KeyboardEvent) { - if (event.ctrlKey) { + if (event.ctrlKey || event.metaKey) { switch (event.key) { case "k": { i.handleInsertLink(i, event); -- 2.44.1