mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 16:58:49 +01:00
This commit is contained in:
parent
03a6c15d70
commit
b4c970f4ba
1 changed files with 19 additions and 1 deletions
|
|
@ -42,6 +42,16 @@ export const matchAuxiliaryHotKey = (hotKey: string, event: KeyboardEvent) => {
|
|||
return true;
|
||||
};
|
||||
|
||||
const replaceDirect = (hotKey: string, keyCode: string) => {
|
||||
const hotKeys = hotKey.replace(keyCode, Constants.ZWSP).split("");
|
||||
hotKeys.forEach((item, index) => {
|
||||
if (item === Constants.ZWSP) {
|
||||
hotKeys[index] = keyCode;
|
||||
}
|
||||
})
|
||||
return hotKeys;
|
||||
}
|
||||
|
||||
export const matchHotKey = (hotKey: string, event: KeyboardEvent) => {
|
||||
if (!hotKey) {
|
||||
return false;
|
||||
|
|
@ -67,7 +77,7 @@ export const matchHotKey = (hotKey: string, event: KeyboardEvent) => {
|
|||
return false;
|
||||
}
|
||||
|
||||
const hotKeys = hotKey.split("");
|
||||
let hotKeys = hotKey.split("");
|
||||
if (hotKey.indexOf("F") > -1) {
|
||||
hotKeys.forEach((item, index) => {
|
||||
if (item === "F") {
|
||||
|
|
@ -78,6 +88,14 @@ export const matchHotKey = (hotKey: string, event: KeyboardEvent) => {
|
|||
}
|
||||
}
|
||||
});
|
||||
} else if (hotKey.indexOf("PageUp") > -1) {
|
||||
hotKeys = replaceDirect(hotKey, "PageUp");
|
||||
} else if (hotKey.indexOf("PageDown") > -1) {
|
||||
hotKeys = replaceDirect(hotKey, "PageDown");
|
||||
} else if (hotKey.indexOf("Home") > -1) {
|
||||
hotKeys = replaceDirect(hotKey, "Home");
|
||||
} else if (hotKey.indexOf("End") > -1) {
|
||||
hotKeys = replaceDirect(hotKey, "End");
|
||||
}
|
||||
|
||||
// 是否匹配 ⇧[]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue