mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-14 03:24:06 +00:00
Add metaKey to markdown-textarea, for macos
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
This commit is contained in:
parent
f87dad3a5c
commit
17bcfe5257
|
@ -473,7 +473,7 @@ export class MarkdownTextArea extends Component<
|
||||||
// Keybind handler
|
// Keybind handler
|
||||||
// Keybinds inspired by github comment area
|
// Keybinds inspired by github comment area
|
||||||
handleKeyBinds(i: MarkdownTextArea, event: KeyboardEvent) {
|
handleKeyBinds(i: MarkdownTextArea, event: KeyboardEvent) {
|
||||||
if (event.ctrlKey) {
|
if (event.ctrlKey || event.metaKey) {
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case "k": {
|
case "k": {
|
||||||
i.handleInsertLink(i, event);
|
i.handleInsertLink(i, event);
|
||||||
|
|
Loading…
Reference in a new issue