mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
This commit is contained in:
parent
84eb6c90e0
commit
e18e9c2750
3 changed files with 12 additions and 5 deletions
|
|
@ -231,7 +231,7 @@ export const keymap = {
|
||||||
keymapStr += "⌦";
|
keymapStr += "⌦";
|
||||||
} else if (event.altKey) {
|
} else if (event.altKey) {
|
||||||
const codeKey = event.code.substr(event.code.length - 1, 1).toUpperCase();
|
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;
|
keymapStr += event.key;
|
||||||
} else if (event.code === "Period") {
|
} else if (event.code === "Period") {
|
||||||
keymapStr += ".";
|
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 = {
|
public static readonly SIYUAN_KEYMAP: IKeymap = {
|
||||||
general: {
|
general: {
|
||||||
enterBack: {default: "⌥←", custom: "⌥←"},
|
enterBack: {default: "⌥←", custom: "⌥←"},
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,9 @@ export const matchHotKey = (hotKey: string, event: KeyboardEvent) => {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hotKeys = hotKey.replace("Enter", Constants.ZWSP).split("");
|
const hotKeys = hotKey.split("");
|
||||||
if (hotKey.endsWith("↑") || hotKey.endsWith("↓") || hotKey.endsWith("→") || hotKey.endsWith("←") || hotKey.endsWith("Enter") || hotKey.endsWith("⇥")) {
|
if (hotKey.endsWith("↑") || hotKey.endsWith("↓") || hotKey.endsWith("→") || hotKey.endsWith("←") ||
|
||||||
|
hotKey.endsWith("↩") || hotKey.endsWith("⇥") || hotKey.indexOf("F") > -1) {
|
||||||
hotKeys.forEach((item, index) => {
|
hotKeys.forEach((item, index) => {
|
||||||
if (item === "↑") {
|
if (item === "↑") {
|
||||||
hotKeys[index] = "ArrowUp";
|
hotKeys[index] = "ArrowUp";
|
||||||
|
|
@ -31,8 +32,14 @@ export const matchHotKey = (hotKey: string, event: KeyboardEvent) => {
|
||||||
hotKeys[index] = "ArrowRight";
|
hotKeys[index] = "ArrowRight";
|
||||||
} else if (item === "⇥") {
|
} else if (item === "⇥") {
|
||||||
hotKeys[index] = "Tab";
|
hotKeys[index] = "Tab";
|
||||||
} else if (item === Constants.ZWSP) {
|
} else if (item === "↩") {
|
||||||
hotKeys[index] = "Enter";
|
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…
Add table
Add a link
Reference in a new issue