FIX: Keyboard shortcut should be platform specific (#801)

This commit is contained in:
Keegan George 2024-09-13 16:18:07 -07:00 committed by GitHub
parent 9cd14b0003
commit 9374cd7ac1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

View File

@ -3,6 +3,8 @@ import { fn } from "@ember/helper";
import { service } from "@ember/service"; import { service } from "@ember/service";
import { and } from "truth-helpers"; import { and } from "truth-helpers";
import DButton from "discourse/components/d-button"; import DButton from "discourse/components/d-button";
import { PLATFORM_KEY_MODIFIER } from "discourse/lib/keyboard-shortcuts";
import { translateModKey } from "discourse/lib/utilities";
import eq from "truth-helpers/helpers/eq"; import eq from "truth-helpers/helpers/eq";
import AiHelperCustomPrompt from "../components/ai-helper-custom-prompt"; import AiHelperCustomPrompt from "../components/ai-helper-custom-prompt";
@ -13,6 +15,10 @@ export default class AiHelperOptionsList extends Component {
return this.site.desktopView && this.args.shortcutVisible; return this.site.desktopView && this.args.shortcutVisible;
} }
get shortcut() {
return translateModKey(`${PLATFORM_KEY_MODIFIER}+alt+p`);
}
<template> <template>
<ul class="ai-helper-options"> <ul class="ai-helper-options">
{{#each @options as |option|}} {{#each @options as |option|}}
@ -33,7 +39,7 @@ export default class AiHelperOptionsList extends Component {
class="ai-helper-options__button" class="ai-helper-options__button"
> >
{{#if (and (eq option.name "proofread") this.showShortcut)}} {{#if (and (eq option.name "proofread") this.showShortcut)}}
<kbd class="shortcut">⌘⌥p</kbd> <kbd class="shortcut">{{this.shortcut}}</kbd>
{{/if}} {{/if}}
</DButton> </DButton>
</li> </li>