fix: mac shortcuts

- "Command" symbol in Navbar
- Show "Alt" symbol instead of text
This commit is contained in:
barredterra 2024-03-07 11:34:54 +01:00
parent 851f9adf9c
commit 4e77e5f0c4
4 changed files with 7 additions and 5 deletions

View file

@ -453,7 +453,7 @@ frappe.ui.form.Toolbar = class Toolbar {
},
true,
{
shortcut: "ctrl+z",
shortcut: "Ctrl+Z",
condition: () => !this.frm.is_form_builder(),
description: __("Undo last action"),
}
@ -465,7 +465,7 @@ frappe.ui.form.Toolbar = class Toolbar {
},
true,
{
shortcut: "ctrl+y",
shortcut: "Ctrl+Y",
condition: () => !this.frm.is_form_builder(),
description: __("Redo last action"),
}

View file

@ -98,7 +98,7 @@ frappe.ui.keys.show_keyboard_shortcut_dialog = () => {
.map(frappe.utils.to_title_case)
.join("+");
if (frappe.utils.is_mac()) {
shortcut_label = shortcut_label.replace("Ctrl", "⌘");
shortcut_label = shortcut_label.replace("Ctrl", "⌘").replace("Alt", "⌥");
}
return `<tr>
<td width="40%"><kbd>${shortcut_label}</kbd></td>

View file

@ -536,7 +536,9 @@ frappe.ui.Page = class Page {
}
// label
if (frappe.utils.is_mac()) {
shortcut_obj.shortcut_label = shortcut_obj.shortcut.replace("Ctrl", "⌘");
shortcut_obj.shortcut_label = shortcut_obj.shortcut
.replace("Ctrl", "⌘")
.replace("Alt", "⌥");
} else {
shortcut_obj.shortcut_label = shortcut_obj.shortcut;
}

View file

@ -26,7 +26,7 @@
id="navbar-search"
type="text"
class="form-control"
placeholder="{%= __("Search or type a command (Ctrl + G)") %}"
placeholder="{%= __('Search or type a command ({0})', [frappe.utils.is_mac() ? '⌘ + G' : 'Ctrl + G']) %}"
aria-haspopup="true"
>
<span class="search-icon">