mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-28 09:40:28 +08:00
Show correct meta key on Linux/macOS in hotkeys modal
This commit is contained in:
@@ -220,7 +220,7 @@
|
||||
</label>
|
||||
or pasting them.
|
||||
{/if}
|
||||
Markdown supported. Press {utils.isMac() ? "⌘" : "ctrl"}↵ to submit.
|
||||
Markdown supported. Press {utils.modifierKey()}↵ to submit.
|
||||
</div>
|
||||
{/if}
|
||||
<div class="buttons">
|
||||
|
||||
+9
-3
@@ -204,14 +204,20 @@ export function scrollIntoView(id: string, options?: ScrollIntoViewOptions) {
|
||||
}
|
||||
|
||||
export function isMac() {
|
||||
// Precaution in case navigator.platform is not available.
|
||||
if (navigator.platform) {
|
||||
return navigator.platform.includes("Mac");
|
||||
if (
|
||||
(navigator.platform && navigator.platform.includes("Mac")) ||
|
||||
navigator.userAgent.includes("OS X")
|
||||
) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function modifierKey() {
|
||||
return isMac() ? "⌘" : "ctrl";
|
||||
}
|
||||
|
||||
// Check whether the given path has a markdown file extension.
|
||||
export function isMarkdownPath(path: string): boolean {
|
||||
return /\.(md|mkd|markdown)$/i.test(path);
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { modifierKey } from "@app/lib/utils";
|
||||
|
||||
import Icon from "@app/components/Icon.svelte";
|
||||
import IconSmall from "@app/components/IconSmall.svelte";
|
||||
import KeyHint from "@app/components/KeyHint.svelte";
|
||||
@@ -39,7 +41,7 @@
|
||||
<div class="pair">
|
||||
<span>Post comment</span>
|
||||
<div class="keys">
|
||||
<KeyHint>⌘</KeyHint> +
|
||||
<KeyHint>{modifierKey()}</KeyHint> +
|
||||
<KeyHint>⏎</KeyHint>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user