Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/14652

Vanessa22923d3eac57
diff --git a/app/src/index.ts b/app/src/index.ts
index 99d68bbb1c..e932fd8bac 100644
--- a/app/src/index.ts
+++ b/app/src/index.ts
@@ -37,6 +37,7 @@ import {setLocalShorthandCount} from "./util/noRelyPCFunction";
/// #endif
import {getDockByType} from "./layout/tabUtil";
import {Tag} from "./layout/dock/Tag";
+import {updateControlAlt} from "./protyle/util/hotKey";
export class App {
public plugins: import("./plugin").Plugin[] = [];
@@ -101,6 +102,7 @@ export class App {
break;
case "setConf":
window.siyuan.config = data.data;
+ updateControlAlt();
break;
case "progress":
progressLoading(data);
@@ -182,6 +184,7 @@ export class App {
addScriptSync(`${Constants.PROTYLE_CDN}/js/lute/lute.min.js?v=${Constants.SIYUAN_VERSION}`, "protyleLuteScript");
addScript(`${Constants.PROTYLE_CDN}/js/protyle-html.js?v=${Constants.SIYUAN_VERSION}`, "protyleWcHtmlScript");
window.siyuan.config = response.data.conf;
+ updateControlAlt();
window.siyuan.isPublish = response.data.isPublish;
await loadPlugins(this);
getLocalStorage(() => {
diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.ts
index 7cc82aef91..469f09f931 100644
--- a/app/src/mobile/index.ts
+++ b/app/src/mobile/index.ts
@@ -29,6 +29,7 @@ import {updateCardHV} from "../card/util";
import {mobileKeydown} from "./util/keydown";
import {correctHotkey} from "../boot/globalEvent/commonHotkey";
import {processIOSPurchaseResponse} from "../util/iOSPurchase";
+import {updateControlAlt} from "../protyle/util/hotKey";
class App {
public plugins: import("../plugin").Plugin[] = [];
@@ -96,6 +97,7 @@ class App {
addScriptSync(`${Constants.PROTYLE_CDN}/js/lute/lute.min.js?v=${Constants.SIYUAN_VERSION}`, "protyleLuteScript");
addScript(`${Constants.PROTYLE_CDN}/js/protyle-html.js?v=${Constants.SIYUAN_VERSION}`, "protyleWcHtmlScript");
window.siyuan.config = confResponse.data.conf;
+ updateControlAlt();
window.siyuan.isPublish = confResponse.data.isPublish;
correctHotkey(siyuanApp);
await loadPlugins(this);
diff --git a/app/src/mobile/util/onMessage.ts b/app/src/mobile/util/onMessage.ts
index 05fe40fe07..035844c910 100644
--- a/app/src/mobile/util/onMessage.ts
+++ b/app/src/mobile/util/onMessage.ts
@@ -10,6 +10,7 @@ import {App} from "../../index";
import {reloadPlugin} from "../../plugin/loader";
import {reloadEmoji} from "../../emoji";
import {setLocalShorthandCount} from "../../util/noRelyPCFunction";
+import {updateControlAlt} from "../../protyle/util/hotKey";
export const onMessage = (app: App, data: IWebSocketData) => {
if (data) {
@@ -37,6 +38,7 @@ export const onMessage = (app: App, data: IWebSocketData) => {
break;
case "setConf":
window.siyuan.config = data.data;
+ updateControlAlt();
break;
case "reloaddoc":
reloadSync(this, {upsertRootIDs: [data.data], removeRootIDs: []}, false, false, true);
diff --git a/app/src/protyle/util/hotKey.ts b/app/src/protyle/util/hotKey.ts
index f14fdcc5b5..f64aaa5ef6 100644
--- a/app/src/protyle/util/hotKey.ts
+++ b/app/src/protyle/util/hotKey.ts
@@ -217,3 +217,21 @@ export const isIncludesHotKey = (hotKey: string) => {
return isInclude;
};
+export const updateControlAlt = () => {
+ Object.keys(window.siyuan.config.keymap.general).forEach(key => {
+ if (["fileTree", "outline", "bookmark", "tag", "dailyNote", "inbox", "backlinks",
+ "graphView", "globalGraph", "riffCard"].includes(key)) {
+ if (navigator.platform.toUpperCase().indexOf("MAC") > -1) {
+ window.siyuan.config.keymap.general[key].default = window.siyuan.config.keymap.general[key].default.replace("⌥", "⌃")
+ if (window.siyuan.config.keymap.general[key].default === window.siyuan.config.keymap.general[key].custom) {
+ window.siyuan.config.keymap.general[key].custom = window.siyuan.config.keymap.general[key].default.replace("⌥", "⌃")
+ }
+ } else {
+ window.siyuan.config.keymap.general[key].default = window.siyuan.config.keymap.general[key].default.replace("⌃", "⌥")
+ if (window.siyuan.config.keymap.general[key].default === window.siyuan.config.keymap.general[key].custom) {
+ window.siyuan.config.keymap.general[key].custom = window.siyuan.config.keymap.general[key].default.replace("⌃", "⌥")
+ }
+ }
+ }
+ });
+};
diff --git a/app/src/window/index.ts b/app/src/window/index.ts
index d8a6d87659..bb847833cb 100644
--- a/app/src/window/index.ts
+++ b/app/src/window/index.ts
@@ -26,6 +26,7 @@ import {init} from "../window/init";
import {loadPlugins, reloadPlugin} from "../plugin/loader";
import {hideAllElements} from "../protyle/ui/hideElements";
import {reloadEmoji} from "../emoji";
+import {updateControlAlt} from "../protyle/util/hotKey";
class App {
public plugins: import("../plugin").Plugin[] = [];
@@ -78,6 +79,7 @@ class App {
break;
case "setConf":
window.siyuan.config = data.data;
+ updateControlAlt();
break;
case "progress":
progressLoading(data);
@@ -155,6 +157,7 @@ class App {
addScriptSync(`${Constants.PROTYLE_CDN}/js/lute/lute.min.js?v=${Constants.SIYUAN_VERSION}`, "protyleLuteScript");
addScript(`${Constants.PROTYLE_CDN}/js/protyle-html.js?v=${Constants.SIYUAN_VERSION}`, "protyleWcHtmlScript");
window.siyuan.config = response.data.conf;
+ updateControlAlt();
window.siyuan.isPublish = response.data.isPublish;
await loadPlugins(this);
getLocalStorage(() => {