Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/11165

Vanessab4c970f4bab8
diff --git a/app/src/protyle/util/hotKey.ts b/app/src/protyle/util/hotKey.ts
index e4bccf090d..692cdaf6f7 100644
--- a/app/src/protyle/util/hotKey.ts
+++ b/app/src/protyle/util/hotKey.ts
@@ -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");
}
// 是否匹配 ⇧[]