mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-21 19:41:05 +08:00
This commit is contained in:
parent
84eb6c90e0
commit
e18e9c2750
@ -231,7 +231,7 @@ export const keymap = {
|
||||
keymapStr += "⌦";
|
||||
} else if (event.altKey) {
|
||||
const codeKey = event.code.substr(event.code.length - 1, 1).toUpperCase();
|
||||
if (event.key === "Enter") {
|
||||
if (event.key === "Enter" || (event.key.startsWith("F") && event.key.length > 1)) {
|
||||
keymapStr += event.key;
|
||||
} else if (event.code === "Period") {
|
||||
keymapStr += ".";
|
||||
|
@ -82,7 +82,7 @@ export abstract class Constants {
|
||||
};
|
||||
|
||||
// "⌘", "⇧", "⌥", "⌃"
|
||||
// "⌘S", "⌘A", "⌘X", "⌘C", "⌘V", "⌘/", "⌘↑", "⌘↓", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⇧⌘⇥", "⌃⇥", "⌃⌘⇥", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧Enter", "Enter", "PageUp", "PageDown", "⌫", "⌦", "F9" 不可自定义
|
||||
// "⌘S", "⌘A", "⌘X", "⌘C", "⌘V", "⌘/", "⌘↑", "⌘↓", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⇧⌘⇥", "⌃⇥", "⌃⌘⇥", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦", "F9" 不可自定义
|
||||
public static readonly SIYUAN_KEYMAP: IKeymap = {
|
||||
general: {
|
||||
enterBack: {default: "⌥←", custom: "⌥←"},
|
||||
|
@ -18,8 +18,9 @@ export const matchHotKey = (hotKey: string, event: KeyboardEvent) => {
|
||||
return false;
|
||||
}
|
||||
|
||||
const hotKeys = hotKey.replace("Enter", Constants.ZWSP).split("");
|
||||
if (hotKey.endsWith("↑") || hotKey.endsWith("↓") || hotKey.endsWith("→") || hotKey.endsWith("←") || hotKey.endsWith("Enter") || hotKey.endsWith("⇥")) {
|
||||
const hotKeys = hotKey.split("");
|
||||
if (hotKey.endsWith("↑") || hotKey.endsWith("↓") || hotKey.endsWith("→") || hotKey.endsWith("←") ||
|
||||
hotKey.endsWith("↩") || hotKey.endsWith("⇥") || hotKey.indexOf("F") > -1) {
|
||||
hotKeys.forEach((item, index) => {
|
||||
if (item === "↑") {
|
||||
hotKeys[index] = "ArrowUp";
|
||||
@ -31,8 +32,14 @@ export const matchHotKey = (hotKey: string, event: KeyboardEvent) => {
|
||||
hotKeys[index] = "ArrowRight";
|
||||
} else if (item === "⇥") {
|
||||
hotKeys[index] = "Tab";
|
||||
} else if (item === Constants.ZWSP) {
|
||||
} else if (item === "↩") {
|
||||
hotKeys[index] = "Enter";
|
||||
} else if (item === "F") {
|
||||
// F1-F12
|
||||
hotKeys[index] = "F" + hotKeys.splice(index + 1, 1);
|
||||
if (hotKeys[index + 1]) {
|
||||
hotKeys[index + 1] += hotKeys.splice(index + 1, 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user