Vanessa 2023-05-03 14:43:19 +08:00
parent 27a955126c
commit bba546d017
2 changed files with 6 additions and 1 deletions

View file

@ -44,7 +44,11 @@ export class Gutter {
constructor(protyle: IProtyle) {
this.element = document.createElement("div");
this.element.className = "protyle-gutters";
this.element.setAttribute("aria-label", window.siyuan.languages.gutterTip.replace(/⌘/g, updateHotkeyTip("⌘")).replace(/⌥/g, updateHotkeyTip("⌥")).replace(/⇧/g, updateHotkeyTip("⇧")).replace(/⌃/g, updateHotkeyTip("⌃")));
if (/Mac/.test(navigator.platform) || navigator.platform === "iPhone") {
this.element.setAttribute("aria-label", window.siyuan.languages.gutterTip);
} else {
this.element.setAttribute("aria-label", window.siyuan.languages.gutterTip.replace(/⌘/g, "Ctrl+").replace(/⌥/g, "Alt+").replace(/⇧/g, "Shift+").replace(/⌃/g, "Ctrl+"));
}
this.element.setAttribute("data-type", "a");
this.element.setAttribute("data-position", "right");
this.element.addEventListener("dragstart", (event: DragEvent & { target: HTMLElement }) => {

View file

@ -101,6 +101,7 @@ export const updateHotkeyTip = (hotkey: string) => {
const KEY_MAP = new Map(Object.entries({
"⌘": "Ctrl",
"⌃": "Ctrl",
"⇧": "Shift",
"⌥": "Alt",
"⇥": "Tab",