Skip to content

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

:art: Improve macOS Application Menu https://github.com/siyuan-note/siyuan/issues/17514

Jeffrey Chen5d6810db5294
diff --git a/app/appearance/langs/ar.json b/app/appearance/langs/ar.json
index 772899e2c6..46ff4b25fc 100644
--- a/app/appearance/langs/ar.json
+++ b/app/appearance/langs/ar.json
@@ -1,4 +1,14 @@
{
+ "appMenuAbout": "حول SiYuan",
+ "appMenuServices": "الخدمات",
+ "appMenuHide": "إخفاء SiYuan",
+ "appMenuHideOthers": "إخفاء الأخرى",
+ "appMenuQuit": "إنهاء SiYuan",
+ "appMenuPasteAndMatchStyle": "لصق ومطابقة التنسيق",
+ "appMenuTogglefullscreen": "ملء الشاشة",
+ "appMenuBringAllToFront": "إحضار الكل إلى المقدمة",
+ "appMenuWindow": "النافذة",
+ "appMenuMinimize": "تصغير",
"useSystemProxy": "استخدام وكيل النظام",
"statusBarMsgDataSync": "مزامنة البيانات",
"entryDocumentStatistics": "إحصاءات المستند",
diff --git a/app/appearance/langs/de.json b/app/appearance/langs/de.json
index 2d226e50ff..f51b1a7519 100644
--- a/app/appearance/langs/de.json
+++ b/app/appearance/langs/de.json
@@ -1,4 +1,14 @@
{
+ "appMenuAbout": "Über SiYuan",
+ "appMenuServices": "Dienste",
+ "appMenuHide": "SiYuan ausblenden",
+ "appMenuHideOthers": "Andere ausblenden",
+ "appMenuQuit": "SiYuan beenden",
+ "appMenuPasteAndMatchStyle": "Einsetzen und Formatierung übernehmen",
+ "appMenuTogglefullscreen": "Vollbild umschalten",
+ "appMenuBringAllToFront": "Alle nach vorne",
+ "appMenuWindow": "Fenster",
+ "appMenuMinimize": "Im Dock ablegen",
"useSystemProxy": "Systemproxy verwenden",
"statusBarMsgDataSync": "Datensynchronisierung",
"entryDocumentStatistics": "Dokumentstatistik",
diff --git a/app/appearance/langs/en.json b/app/appearance/langs/en.json
index 513cfaa4b4..528f9fbf42 100644
--- a/app/appearance/langs/en.json
+++ b/app/appearance/langs/en.json
@@ -1,4 +1,14 @@
{
+ "appMenuAbout": "About SiYuan",
+ "appMenuServices": "Services",
+ "appMenuHide": "Hide SiYuan",
+ "appMenuHideOthers": "Hide Others",
+ "appMenuQuit": "Quit SiYuan",
+ "appMenuPasteAndMatchStyle": "Paste and Match Style",
+ "appMenuTogglefullscreen": "Toggle Full Screen",
+ "appMenuBringAllToFront": "Bring All to Front",
+ "appMenuWindow": "Window",
+ "appMenuMinimize": "Minimize",
"useSystemProxy": "Use system proxy",
"statusBarMsgDataSync": "Data synchronization",
"entryDocumentStatistics": "Document statistics",
diff --git a/app/appearance/langs/es.json b/app/appearance/langs/es.json
index 50ffa203cb..4ed75fa9af 100644
--- a/app/appearance/langs/es.json
+++ b/app/appearance/langs/es.json
@@ -1,4 +1,14 @@
{
+ "appMenuAbout": "Acerca de SiYuan",
+ "appMenuServices": "Servicios",
+ "appMenuHide": "Ocultar SiYuan",
+ "appMenuHideOthers": "Ocultar otros",
+ "appMenuQuit": "Salir de SiYuan",
+ "appMenuPasteAndMatchStyle": "Pegar y combinar formato",
+ "appMenuTogglefullscreen": "Pantalla completa",
+ "appMenuBringAllToFront": "Traer todo al frente",
+ "appMenuWindow": "Ventana",
+ "appMenuMinimize": "Minimizar",
"useSystemProxy": "Usar proxy del sistema",
"statusBarMsgDataSync": "Sincronización de datos",
"entryDocumentStatistics": "Estadísticas del documento",
diff --git a/app/appearance/langs/fr.json b/app/appearance/langs/fr.json
index bc4ac71ce6..c903cc1ee3 100644
--- a/app/appearance/langs/fr.json
+++ b/app/appearance/langs/fr.json
@@ -1,4 +1,14 @@
{
+ "appMenuAbout": "À propos de SiYuan",
+ "appMenuServices": "Services",
+ "appMenuHide": "Masquer SiYuan",
+ "appMenuHideOthers": "Masquer les autres",
+ "appMenuQuit": "Quitter SiYuan",
+ "appMenuPasteAndMatchStyle": "Coller et adapter le style",
+ "appMenuTogglefullscreen": "Basculer en plein écran",
+ "appMenuBringAllToFront": "Tout ramener au premier plan",
+ "appMenuWindow": "Fenêtre",
+ "appMenuMinimize": "Réduire",
"useSystemProxy": "Utiliser le proxy système",
"statusBarMsgDataSync": "Synchronisation des données",
"entryDocumentStatistics": "Statistiques du document",
diff --git a/app/appearance/langs/he.json b/app/appearance/langs/he.json
index 52dc66cb3d..f8897ee968 100644
--- a/app/appearance/langs/he.json
+++ b/app/appearance/langs/he.json
@@ -1,4 +1,14 @@
{
+ "appMenuAbout": "אודות SiYuan",
+ "appMenuServices": "שירותים",
+ "appMenuHide": "הסתר את SiYuan",
+ "appMenuHideOthers": "הסתר אחרים",
+ "appMenuQuit": "צא מ-SiYuan",
+ "appMenuPasteAndMatchStyle": "הדבק והתאם לסגנון",
+ "appMenuTogglefullscreen": "מסך מלא",
+ "appMenuBringAllToFront": "הבא את הכול לחזית",
+ "appMenuWindow": "חלון",
+ "appMenuMinimize": "מזער",
"useSystemProxy": "שימוש בשרת ה-Proxy של המערכת",
"statusBarMsgDataSync": "סנכרון נתונים",
"entryDocumentStatistics": "סטטיסטיקות מסמך",
diff --git a/app/appearance/langs/hi.json b/app/appearance/langs/hi.json
index a994721f78..c9015ee951 100644
--- a/app/appearance/langs/hi.json
+++ b/app/appearance/langs/hi.json
@@ -1,4 +1,14 @@
{
+ "appMenuAbout": "SiYuan के बारे में",
+ "appMenuServices": "सेवाएँ",
+ "appMenuHide": "SiYuan छिपाएँ",
+ "appMenuHideOthers": "अन्य छिपाएँ",
+ "appMenuQuit": "SiYuan से बाहर निकलें",
+ "appMenuPasteAndMatchStyle": "पेस्ट करें और शैली मिलाएँ",
+ "appMenuTogglefullscreen": "पूर्ण स्क्रीन टॉगल करें",
+ "appMenuBringAllToFront": "सभी को आगे लाएँ",
+ "appMenuWindow": "विंडो",
+ "appMenuMinimize": "छोटा करें",
"useSystemProxy": "सिस्टम प्रॉक्सी का उपयोग करें",
"statusBarMsgDataSync": "डेटा सिंक्रोनाइज़ेशन",
"entryDocumentStatistics": "दस्तावेज़ के आँकड़े",
diff --git a/app/appearance/langs/id.json b/app/appearance/langs/id.json
index 2aa03603cf..f187d2ba5c 100644
--- a/app/appearance/langs/id.json
+++ b/app/appearance/langs/id.json
@@ -1,4 +1,14 @@
{
+ "appMenuAbout": "Tentang SiYuan",
+ "appMenuServices": "Layanan",
+ "appMenuHide": "Sembunyikan SiYuan",
+ "appMenuHideOthers": "Sembunyikan lainnya",
+ "appMenuQuit": "Keluar dari SiYuan",
+ "appMenuPasteAndMatchStyle": "Tempel dan sesuaikan gaya",
+ "appMenuTogglefullscreen": "Layar penuh",
+ "appMenuBringAllToFront": "Bawa semua ke depan",
+ "appMenuWindow": "Jendela",
+ "appMenuMinimize": "Minimalkan",
"useSystemProxy": "Gunakan proksi sistem",
"statusBarMsgDataSync": "Sinkronisasi data",
"entryDocumentStatistics": "Statistik dokumen",
diff --git a/app/appearance/langs/it.json b/app/appearance/langs/it.json
index bdd72874af..6b573fea44 100644
--- a/app/appearance/langs/it.json
+++ b/app/appearance/langs/it.json
@@ -1,4 +1,14 @@
{
+ "appMenuAbout": "Informazioni su SiYuan",
+ "appMenuServices": "Servizi",
+ "appMenuHide": "Nascondi SiYuan",
+ "appMenuHideOthers": "Nascondi altre app",
+ "appMenuQuit": "Chiudi SiYuan",
+ "appMenuPasteAndMatchStyle": "Incolla e mantieni formattazione",
+ "appMenuTogglefullscreen": "Schermo intero",
+ "appMenuBringAllToFront": "Porta tutto in primo piano",
+ "appMenuWindow": "Finestra",
+ "appMenuMinimize": "Contrai",
"useSystemProxy": "Usa proxy di sistema",
"statusBarMsgDataSync": "Sincronizzazione dei dati",
"entryDocumentStatistics": "Statistiche del documento",
diff --git a/app/appearance/langs/ja.json b/app/appearance/langs/ja.json
index bf8fc7f32c..398cc487e0 100644
--- a/app/appearance/langs/ja.json
+++ b/app/appearance/langs/ja.json
@@ -1,4 +1,14 @@
{
+ "appMenuAbout": "SiYuan について",
+ "appMenuServices": "サービス",
+ "appMenuHide": "SiYuan を隠す",
+ "appMenuHideOthers": "ほかを隠す",
+ "appMenuQuit": "SiYuan を終了",
+ "appMenuPasteAndMatchStyle": "スタイルを合わせてペースト",
+ "appMenuTogglefullscreen": "フルスクリーンの切り替え",
+ "appMenuBringAllToFront": "すべてを手前に移動",
+ "appMenuWindow": "ウィンドウ",
+ "appMenuMinimize": "しまう",
"useSystemProxy": "システムプロキシを使用",
"statusBarMsgDataSync": "データ同期",
"entryDocumentStatistics": "ドキュメント統計",
diff --git a/app/appearance/langs/ko.json b/app/appearance/langs/ko.json
index a07dd1798b..421e08c233 100644
--- a/app/appearance/langs/ko.json
+++ b/app/appearance/langs/ko.json
@@ -1,4 +1,14 @@
{
+ "appMenuAbout": "SiYuan 정보",
+ "appMenuServices": "서비스",
+ "appMenuHide": "SiYuan 숨기기",
+ "appMenuHideOthers": "기타 가리기",
+ "appMenuQuit": "SiYuan 종료",
+ "appMenuPasteAndMatchStyle": "스타일에 맞게 붙여넣기",
+ "appMenuTogglefullscreen": "전체 화면 전환",
+ "appMenuBringAllToFront": "모두 앞으로 가져오기",
+ "appMenuWindow": "윈도우",
+ "appMenuMinimize": "축소",
"useSystemProxy": "시스템 프록시 사용",
"statusBarMsgDataSync": "데이터 동기화",
"entryDocumentStatistics": "문서 통계",
diff --git a/app/appearance/langs/nl.json b/app/appearance/langs/nl.json
index 2e4a8eeaf2..f0cb008e38 100644
--- a/app/appearance/langs/nl.json
+++ b/app/appearance/langs/nl.json
@@ -1,4 +1,14 @@
{
+ "appMenuAbout": "Over SiYuan",
+ "appMenuServices": "Voorzieningen",
+ "appMenuHide": "Verberg SiYuan",
+ "appMenuHideOthers": "Verberg andere",
+ "appMenuQuit": "Stop SiYuan",
+ "appMenuPasteAndMatchStyle": "Plak en pas stijl aan",
+ "appMenuTogglefullscreen": "Schermvullende weergave",
+ "appMenuBringAllToFront": "Breng alles naar voren",
+ "appMenuWindow": "Venster",
+ "appMenuMinimize": "Zet in Dock",
"useSystemProxy": "Systeemproxy gebruiken",
"statusBarMsgDataSync": "Gegevenssynchronisatie",
"entryDocumentStatistics": "Documentstatistieken",
diff --git a/app/appearance/langs/pl.json b/app/appearance/langs/pl.json
index 5c35be8f47..dd90a996bd 100644
--- a/app/appearance/langs/pl.json
+++ b/app/appearance/langs/pl.json
@@ -1,4 +1,14 @@
{
+ "appMenuAbout": "O programie SiYuan",
+ "appMenuServices": "Usługi",
+ "appMenuHide": "Ukryj SiYuan",
+ "appMenuHideOthers": "Ukryj pozostałe",
+ "appMenuQuit": "Zakończ SiYuan",
+ "appMenuPasteAndMatchStyle": "Wklej i dopasuj styl",
+ "appMenuTogglefullscreen": "Pełny ekran",
+ "appMenuBringAllToFront": "Przenieś wszystkie na wierzch",
+ "appMenuWindow": "Okno",
+ "appMenuMinimize": "Minimalizuj",
"useSystemProxy": "Użyj systemowego serwera proxy",
"statusBarMsgDataSync": "Synchronizacja danych",
"entryDocumentStatistics": "Statystyki dokumentu",
diff --git a/app/appearance/langs/pt-BR.json b/app/appearance/langs/pt-BR.json
index 1faa8c9e09..56862ba210 100644
--- a/app/appearance/langs/pt-BR.json
+++ b/app/appearance/langs/pt-BR.json
@@ -1,4 +1,14 @@
{
+ "appMenuAbout": "Sobre o SiYuan",
+ "appMenuServices": "Serviços",
+ "appMenuHide": "Ocultar SiYuan",
+ "appMenuHideOthers": "Ocultar outros",
+ "appMenuQuit": "Encerrar SiYuan",
+ "appMenuPasteAndMatchStyle": "Colar e combinar estilo",
+ "appMenuTogglefullscreen": "Tela cheia",
+ "appMenuBringAllToFront": "Trazer tudo para a frente",
+ "appMenuWindow": "Janela",
+ "appMenuMinimize": "Minimizar",
"useSystemProxy": "Usar proxy do sistema",
"statusBarMsgDataSync": "Sincronização de dados",
"entryDocumentStatistics": "Estatísticas do documento",
diff --git a/app/appearance/langs/ru.json b/app/appearance/langs/ru.json
index c96c4a6933..84c71a6dfa 100644
--- a/app/appearance/langs/ru.json
+++ b/app/appearance/langs/ru.json
@@ -1,4 +1,14 @@
{
+ "appMenuAbout": "О программе SiYuan",
+ "appMenuServices": "Службы",
+ "appMenuHide": "Скрыть SiYuan",
+ "appMenuHideOthers": "Скрыть остальные",
+ "appMenuQuit": "Завершить SiYuan",
+ "appMenuPasteAndMatchStyle": "Вставить с учётом стиля",
+ "appMenuTogglefullscreen": "Полноэкранный режим",
+ "appMenuBringAllToFront": "Все окна на передний план",
+ "appMenuWindow": "Окно",
+ "appMenuMinimize": "Свернуть",
"useSystemProxy": "Использовать системный прокси",
"statusBarMsgDataSync": "Синхронизация данных",
"entryDocumentStatistics": "Статистика документа",
diff --git a/app/appearance/langs/sk.json b/app/appearance/langs/sk.json
index faa3f124bb..e609c8ce19 100644
--- a/app/appearance/langs/sk.json
+++ b/app/appearance/langs/sk.json
@@ -1,4 +1,14 @@
{
+ "appMenuAbout": "O aplikácii SiYuan",
+ "appMenuServices": "Služby",
+ "appMenuHide": "Skryť SiYuan",
+ "appMenuHideOthers": "Skryť ostatné",
+ "appMenuQuit": "Ukončiť SiYuan",
+ "appMenuPasteAndMatchStyle": "Vložiť a prispôsobiť štýl",
+ "appMenuTogglefullscreen": "Celá obrazovka",
+ "appMenuBringAllToFront": "Presunúť všetko dopredu",
+ "appMenuWindow": "Okno",
+ "appMenuMinimize": "Minimalizovať",
"useSystemProxy": "Použiť systémový proxy server",
"statusBarMsgDataSync": "Synchronizácia údajov",
"entryDocumentStatistics": "Štatistiky dokumentu",
diff --git a/app/appearance/langs/th.json b/app/appearance/langs/th.json
index 8ced50e45f..2bea2741be 100644
--- a/app/appearance/langs/th.json
+++ b/app/appearance/langs/th.json
@@ -1,4 +1,14 @@
{
+ "appMenuAbout": "เกี่ยวกับ SiYuan",
+ "appMenuServices": "บริการ",
+ "appMenuHide": "ซ่อน SiYuan",
+ "appMenuHideOthers": "ซ่อนรายการอื่น",
+ "appMenuQuit": "ออกจาก SiYuan",
+ "appMenuPasteAndMatchStyle": "วางและจัดให้เข้ากับรูปแบบ",
+ "appMenuTogglefullscreen": "สลับเต็มหน้าจอ",
+ "appMenuBringAllToFront": "นำทั้งหมดมาไว้ข้างหน้า",
+ "appMenuWindow": "หน้าต่าง",
+ "appMenuMinimize": "ย่อหน้าต่าง",
"useSystemProxy": "ใช้พร็อกซีของระบบ",
"statusBarMsgDataSync": "การซิงค์ข้อมูล",
"entryDocumentStatistics": "สถิติเอกสาร",
diff --git a/app/appearance/langs/tr.json b/app/appearance/langs/tr.json
index a0e5955715..d1f103d94a 100644
--- a/app/appearance/langs/tr.json
+++ b/app/appearance/langs/tr.json
@@ -1,4 +1,14 @@
{
+ "appMenuAbout": "SiYuan Hakkında",
+ "appMenuServices": "Hizmetler",
+ "appMenuHide": "SiYuan'ı Gizle",
+ "appMenuHideOthers": "Diğerlerini Gizle",
+ "appMenuQuit": "SiYuan'dan Çık",
+ "appMenuPasteAndMatchStyle": "Biçimi Koruyarak Yapıştır",
+ "appMenuTogglefullscreen": "Tam Ekran",
+ "appMenuBringAllToFront": "Tümünü Öne Getir",
+ "appMenuWindow": "Pencere",
+ "appMenuMinimize": "Küçült",
"useSystemProxy": "Sistem proxy'sini kullan",
"statusBarMsgDataSync": "Veri senkronizasyonu",
"entryDocumentStatistics": "Belge istatistikleri",
diff --git a/app/appearance/langs/uk.json b/app/appearance/langs/uk.json
index 57fb63bad1..db6786fc4c 100644
--- a/app/appearance/langs/uk.json
+++ b/app/appearance/langs/uk.json
@@ -1,4 +1,14 @@
{
+ "appMenuAbout": "Про SiYuan",
+ "appMenuServices": "Служби",
+ "appMenuHide": "Сховати SiYuan",
+ "appMenuHideOthers": "Сховати інші",
+ "appMenuQuit": "Завершити SiYuan",
+ "appMenuPasteAndMatchStyle": "Вставити зі збереженням стилю",
+ "appMenuTogglefullscreen": "Повноекранний режим",
+ "appMenuBringAllToFront": "Усі вікна на передній план",
+ "appMenuWindow": "Вікно",
+ "appMenuMinimize": "Згорнути",
"useSystemProxy": "Використовувати системний проксі",
"statusBarMsgDataSync": "Синхронізація даних",
"entryDocumentStatistics": "Статистика документа",
diff --git a/app/appearance/langs/zh-CN.json b/app/appearance/langs/zh-CN.json
index 5aa2cffac8..e7bdd238d5 100644
--- a/app/appearance/langs/zh-CN.json
+++ b/app/appearance/langs/zh-CN.json
@@ -1,4 +1,14 @@
{
+ "appMenuAbout": "关于思源笔记",
+ "appMenuServices": "服务",
+ "appMenuHide": "隐藏思源笔记",
+ "appMenuHideOthers": "隐藏其他",
+ "appMenuQuit": "退出思源笔记",
+ "appMenuPasteAndMatchStyle": "粘贴并匹配样式",
+ "appMenuTogglefullscreen": "切换全屏幕",
+ "appMenuBringAllToFront": "前置全部窗口",
+ "appMenuWindow": "窗口",
+ "appMenuMinimize": "最小化",
"useSystemProxy": "使用系统代理",
"statusBarMsgDataSync": "数据同步",
"entryDocumentStatistics": "文档统计",
diff --git a/app/appearance/langs/zh-TW.json b/app/appearance/langs/zh-TW.json
index 1f08ae3aa5..c08159baa1 100644
--- a/app/appearance/langs/zh-TW.json
+++ b/app/appearance/langs/zh-TW.json
@@ -1,4 +1,14 @@
{
+ "appMenuAbout": "關於思源筆記",
+ "appMenuServices": "服務",
+ "appMenuHide": "隱藏思源筆記",
+ "appMenuHideOthers": "隱藏其他",
+ "appMenuQuit": "結束思源筆記",
+ "appMenuPasteAndMatchStyle": "貼上並符合樣式",
+ "appMenuTogglefullscreen": "切換全螢幕",
+ "appMenuBringAllToFront": "將所有視窗移到最上層",
+ "appMenuWindow": "視窗",
+ "appMenuMinimize": "最小化",
"useSystemProxy": "使用系統代理",
"statusBarMsgDataSync": "資料同步",
"entryDocumentStatistics": "文件統計",
diff --git a/app/electron/main.js b/app/electron/main.js
index 6045248962..46629ad931 100644
--- a/app/electron/main.js
+++ b/app/electron/main.js
@@ -71,6 +71,9 @@ let bootWindow;
let latestActiveWindow;
let firstOpen = false;
let workspaces = []; // workspaceDir, id, port, webContentsId, browserWindow, tray, hideShortcut
+const initEventId = [];
+const appMenuByWorkspaceDir = new Map();
+const appMenuWorkspaceByWebContentsId = new Map();
let kernelPort = 6806;
let resetWindowStateOnRestart = false;
let openAsHidden = false;
@@ -380,6 +383,208 @@ const hotKey2Electron = (key) => {
.replace("+", "Plus").replace("⇥", "Tab").replace("⌫", "Backspace").replace("⌦", "Delete").replace("↩", "Return");
};
+const getFeedbackUrl = (lang) => {
+ return "zh-CN" === lang
+ ? "https://ld246.com/article/1649901726096"
+ : "https://liuyun.io/article/1686530886208";
+};
+
+const withHotkey = (hotkey, overrideRoleDefault = false) => {
+ if (typeof hotkey !== "string" || !hotkey.length) {
+ // 空快捷键:自定义项不注册加速键;role 项需显式覆盖系统默认加速键
+ return overrideRoleDefault ? {accelerator: "", registerAccelerator: false} : {};
+ }
+ const acc = hotKey2Electron(hotkey);
+ return acc ? {accelerator: acc} : (overrideRoleDefault ? {accelerator: "", registerAccelerator: false} : {});
+};
+
+const forgetAppMenuWebContents = (webContentsId) => {
+ const workspaceDir = appMenuWorkspaceByWebContentsId.get(webContentsId);
+ appMenuWorkspaceByWebContentsId.delete(webContentsId);
+ const initIndex = initEventId.indexOf(webContentsId);
+ if (initIndex > -1) {
+ initEventId.splice(initIndex, 1);
+ }
+ if (!workspaceDir) {
+ return;
+ }
+ for (const mappedDir of appMenuWorkspaceByWebContentsId.values()) {
+ if (mappedDir === workspaceDir) {
+ return;
+ }
+ }
+ appMenuByWorkspaceDir.delete(workspaceDir);
+};
+
+const isInitializedAppWindow = (wnd) => {
+ return !!(wnd && !wnd.isDestroyed() && initEventId.includes(wnd.webContents.id));
+};
+
+const getAppWindow = () => {
+ const focused = BrowserWindow.getFocusedWindow();
+ if (isInitializedAppWindow(focused)) {
+ return focused;
+ }
+ if (isInitializedAppWindow(latestActiveWindow)) {
+ return latestActiveWindow;
+ }
+ const workspaceWindow = workspaces.find((item) => isInitializedAppWindow(item.browserWindow));
+ if (workspaceWindow) {
+ return workspaceWindow.browserWindow;
+ }
+ return BrowserWindow.getAllWindows().find(isInitializedAppWindow) || null;
+};
+
+const setNonDarwinApplicationMenu = () => {
+ const productName = "SiYuan";
+ const template = [{
+ label: productName, submenu: [{
+ label: `About ${productName}`, role: "about",
+ }, {type: "separator"}, {role: "services"}, {type: "separator"}, {
+ label: `Hide ${productName}`, role: "hide",
+ }, {role: "hideOthers"}, {role: "unhide"}, {type: "separator"}, {
+ label: `Quit ${productName}`, role: "quit",
+ },],
+ }, {
+ role: "editMenu", submenu: [{role: "cut"}, {role: "copy"}, {role: "paste"}, {role: "selectAll"}],
+ }, {
+ role: "windowMenu",
+ submenu: [{role: "minimize"}, {role: "zoom"}, {role: "togglefullscreen"}, {type: "separator"}, {role: "toggledevtools"}, {type: "separator"}, {role: "front"},],
+ },];
+ Menu.setApplicationMenu(Menu.buildFromTemplate(template));
+};
+
+const applyMacAppMenu = (sync) => {
+ if ("darwin" !== process.platform || !sync || !sync.i18n || typeof sync.i18n !== "object" ||
+ !sync.hotkey || typeof sync.hotkey !== "object") {
+ return;
+ }
+ /** @type {import("electron").MenuItemConstructorOptions[]} */
+ const template = [{
+ role: "appMenu",
+ label: app.name,
+ submenu: [
+ {role: "about", label: sync.i18n.about || "About SiYuan"},
+ ...(sync.readonly ? [] : [{
+ label: sync.i18n.config || "Settings",
+ click: () => {
+ getAppWindow()?.webContents.send("siyuan-open-setting");
+ },
+ ...withHotkey(sync.hotkey.config),
+ }]),
+ {type: "separator"},
+ {role: "services", label: sync.i18n.services || "Services"},
+ {type: "separator"},
+ {
+ label: sync.i18n.toggleMainWindow || "Hide/Show Window",
+ click: () => {
+ toggleMainWindow(getAppWindow());
+ },
+ ...withHotkey(sync.hotkey.toggleWin),
+ },
+ {role: "hide", label: sync.i18n.hide || "Hide SiYuan"},
+ {role: "hideOthers", label: sync.i18n.hideOthers || "Hide Others"},
+ {role: "unhide", label: sync.i18n.showAll || "Show All"},
+ {type: "separator"},
+ {role: "quit", label: sync.i18n.quit || "Quit SiYuan"},
+ ],
+ }, {
+ role: "editMenu",
+ label: sync.i18n.edit || "Edit",
+ submenu: [
+ {role: "undo", label: sync.i18n.undo || "Undo", ...withHotkey(sync.hotkey.undo, true)},
+ {role: "redo", label: sync.i18n.redo || "Redo", ...withHotkey(sync.hotkey.redo, true)},
+ {type: "separator"},
+ {role: "cut", label: sync.i18n.cut || "Cut"},
+ {role: "copy", label: sync.i18n.copy || "Copy"},
+ {role: "paste", label: sync.i18n.paste || "Paste"},
+ {role: "pasteAndMatchStyle", label: sync.i18n.pasteAndMatchStyle || "Paste and Match Style"},
+ {type: "separator"},
+ {role: "selectAll", label: sync.i18n.selectAll || "Select All"},
+ ],
+ }, {
+ role: "windowMenu",
+ label: sync.i18n.window || "Window",
+ submenu: [
+ {role: "minimize", label: sync.i18n.minimize || "Minimize"},
+ {role: "zoom", label: sync.i18n.zoom || "Zoom"},
+ {role: "togglefullscreen", label: sync.i18n.togglefullscreen || "Toggle Full Screen"},
+ {type: "separator"},
+ {
+ label: sync.i18n.bringAllToFront || "Bring All to Front",
+ click: () => {
+ const windows = BrowserWindow.getAllWindows();
+ windows.forEach(showWindow);
+ const target = (latestActiveWindow && !latestActiveWindow.isDestroyed() && windows.includes(latestActiveWindow))
+ ? latestActiveWindow
+ : windows[0];
+ target?.focus();
+ },
+ },
+ ],
+ }, {
+ role: "help",
+ label: sync.i18n.help || "Help",
+ submenu: [
+ ...(sync.readonly ? [] : [{
+ label: sync.i18n.userGuide || "User Guide",
+ click: () => {
+ getAppWindow()?.webContents.send("siyuan-open-help");
+ },
+ }]),
+ {
+ label: sync.i18n.feedback || "Feedback",
+ click: () => {
+ shell.openExternal(getFeedbackUrl(sync.lang));
+ },
+ },
+ {
+ label: sync.i18n.officialWebsite || "Visit official website",
+ click: () => {
+ shell.openExternal("https://b3log.org/siyuan");
+ },
+ },
+ {
+ label: sync.i18n.openSource || "Visit project on GitHub",
+ click: () => {
+ shell.openExternal("https://github.com/siyuan-note/siyuan");
+ },
+ },
+ {role: "toggledevtools", label: sync.i18n.debug || "Developer Tools"},
+ ],
+ }];
+ Menu.setApplicationMenu(Menu.buildFromTemplate(template));
+};
+
+const applyMacAppMenuForWindow = (wnd) => {
+ if ("darwin" !== process.platform || !wnd || wnd.isDestroyed()) {
+ return;
+ }
+ const workspaceDir = appMenuWorkspaceByWebContentsId.get(wnd.webContents.id);
+ if (!workspaceDir) {
+ return;
+ }
+ applyMacAppMenu(appMenuByWorkspaceDir.get(workspaceDir));
+};
+
+const shouldApplyAppMenuFrom = (webContentsId, workspaceDir) => {
+ const focused = BrowserWindow.getFocusedWindow();
+ if (isInitializedAppWindow(focused)) {
+ if (focused.webContents.id === webContentsId) {
+ return true;
+ }
+ return appMenuWorkspaceByWebContentsId.get(focused.webContents.id) === workspaceDir;
+ }
+ if (isInitializedAppWindow(latestActiveWindow)) {
+ if (latestActiveWindow.webContents.id === webContentsId) {
+ return true;
+ }
+ const latestWorkspace = appMenuWorkspaceByWebContentsId.get(latestActiveWindow.webContents.id);
+ return !latestWorkspace || latestWorkspace === workspaceDir;
+ }
+ return true;
+};
+
/**
* 将 RFC 5646 格式的语言标签解析为应用支持的语言代码
* https://www.rfc-editor.org/info/rfc5646
@@ -1150,30 +1355,9 @@ const initMainWindow = (currentKernelPort = kernelPort) => {
}
});
- if (windowState.isDevToolsOpened) {
- currentWindow.webContents.openDevTools({mode: "bottom"});
+ if ("darwin" !== process.platform) {
+ setNonDarwinApplicationMenu();
}
-
- // 菜单
- const productName = "SiYuan";
- const template = [{
- label: productName, submenu: [{
- label: `About ${productName}`, role: "about",
- }, {type: "separator"}, {role: "services"}, {type: "separator"}, {
- label: `Hide ${productName}`, role: "hide",
- }, {role: "hideOthers"}, {role: "unhide"}, {type: "separator"}, {
- label: `Quit ${productName}`, role: "quit",
- },],
- }, {
- role: "editMenu", submenu: [{role: "cut"}, {role: "copy"}, {role: "paste"}, {
- role: "pasteAndMatchStyle", accelerator: "CmdOrCtrl+Shift+C"
- }, {role: "selectAll"},],
- }, {
- role: "windowMenu",
- submenu: [{role: "minimize"}, {role: "zoom"}, {role: "togglefullscreen"}, {type: "separator"}, {role: "toggledevtools"}, {type: "separator"}, {role: "front"},],
- },];
- const menu = Menu.buildFromTemplate(template);
- Menu.setApplicationMenu(menu);
// 当前页面链接使用浏览器打开
windowNavigate(currentWindow, "app");
currentWindow.on("close", (event) => {
@@ -1209,6 +1393,9 @@ const initMainWindow = (currentKernelPort = kernelPort) => {
} else {
currentWindow.unmaximize();
}
+ if (windowState.isDevToolsOpened) {
+ currentWindow.webContents.openDevTools(); // 保证开发者工具窗口在前
+ }
}
if (bootWindow && !bootWindow.isDestroyed()) {
bootWindow.destroy();
@@ -1227,6 +1414,33 @@ const showWindow = (wnd) => {
wnd.show();
};
+const hideWindow = (wnd) => {
+ // 通过 `Alt+M` 最小化后焦点回到先前的窗口 https://github.com/siyuan-note/siyuan/issues/7275
+ wnd.minimize();
+ // Mac 隐藏后无法再 Dock 中显示
+ if ("win32" === process.platform || "linux" === process.platform) {
+ wnd.hide();
+ }
+};
+
+const toggleMainWindow = (mainWindow) => {
+ if (!mainWindow || mainWindow.isDestroyed()) {
+ return;
+ }
+ if (mainWindow.isMinimized()) {
+ mainWindow.restore();
+ mainWindow.show(); // 按 `Alt+M` 后隐藏窗口,再次按 `Alt+M` 显示窗口后会卡住不能编辑 https://github.com/siyuan-note/siyuan/issues/8456
+ } else if (mainWindow.isVisible()) {
+ if (!mainWindow.isFocused()) {
+ mainWindow.show();
+ } else {
+ hideWindow(mainWindow);
+ }
+ } else {
+ mainWindow.show();
+ }
+};
+
const showAppleSiliconWarning = async (lang) => {
if (!shouldShowAppleSiliconWarning({
isDevelopment: isDevEnv,
@@ -1474,6 +1688,11 @@ const initKernel = (workspace, port, lang, safeMode) => {
};
app.whenReady().then(() => {
+ if ("darwin" === process.platform) {
+ Menu.setApplicationMenu(Menu.buildFromTemplate([{role: "appMenu"}]));
+ } else {
+ setNonDarwinApplicationMenu();
+ }
// Trust self-signed TLS certificates for local HTTPS server
session.defaultSession.setCertificateVerifyProc((request, callback) => {
if (request.hostname === "127.0.0.1" || request.hostname === "localhost") {
@@ -1565,14 +1784,6 @@ app.whenReady().then(() => {
const contextMenu = Menu.buildFromTemplate(trayMenuTemplate);
tray.setContextMenu(contextMenu);
};
- const hideWindow = (wnd) => {
- // 通过 `Alt+M` 最小化后焦点回到先前的窗口 https://github.com/siyuan-note/siyuan/issues/7275
- wnd.minimize();
- // Mac 隐藏后无法再 Dock 中显示
- if ("win32" === process.platform || "linux" === process.platform) {
- wnd.hide();
- }
- };
const showHideWindow = (tray, lang, mainWindow) => {
if (!mainWindow || mainWindow.isDestroyed()) {
return;
@@ -1589,6 +1800,23 @@ app.whenReady().then(() => {
resetTrayMenu(tray, lang, mainWindow);
};
+ // 由渲染进程同步 macOS 应用菜单的文案与快捷键
+ ipcMain.on("siyuan-sync-app-menu", (event, sync) => {
+ if ("darwin" !== process.platform) {
+ return;
+ }
+ if (!sync || !sync.i18n || typeof sync.i18n !== "object" || !sync.hotkey || typeof sync.hotkey !== "object") {
+ return;
+ }
+ const workspaceDir = (typeof sync.workspaceDir === "string" && sync.workspaceDir)
+ ? sync.workspaceDir
+ : ("webContents:" + event.sender.id);
+ appMenuByWorkspaceDir.set(workspaceDir, sync);
+ appMenuWorkspaceByWebContentsId.set(event.sender.id, workspaceDir);
+ if (shouldApplyAppMenuFrom(event.sender.id, workspaceDir)) {
+ applyMacAppMenu(sync);
+ }
+ });
const getWindowByContentId = (id) => {
return BrowserWindow.getAllWindows().find((win) => win.webContents.id === id);
@@ -1868,7 +2096,6 @@ app.whenReady().then(() => {
}
});
- const initEventId = [];
ipcMain.on("siyuan-event", (event) => {
if (initEventId.includes(event.sender.id)) {
return;
@@ -1879,9 +2106,15 @@ app.whenReady().then(() => {
return;
}
latestActiveWindow = currentWindow;
+ applyMacAppMenuForWindow(currentWindow);
+ const webContentsId = currentWindow.webContents.id;
+ currentWindow.on("closed", () => {
+ forgetAppMenuWebContents(webContentsId);
+ });
currentWindow.on("focus", () => {
event.sender.send("siyuan-event", "focus");
latestActiveWindow = currentWindow;
+ applyMacAppMenuForWindow(currentWindow);
});
currentWindow.on("blur", () => {
event.sender.send("siyuan-event", "blur");
@@ -1936,8 +2169,23 @@ app.whenReady().then(() => {
case "openPath":
shell.openPath(data.filePath);
break;
- case "openDevTools":
- event.sender.openDevTools({mode: "bottom"});
+ case "openDevTools": {
+ /** @type {import("electron").OpenDevToolsOptions} */
+ const options = {};
+ if (["left", "right", "bottom", "undocked", "detach"].includes(data.mode)) {
+ options.mode = data.mode;
+ }
+ if (typeof data.activate === "boolean") {
+ options.activate = data.activate;
+ }
+ if (typeof data.title === "string") {
+ options.title = data.title;
+ }
+ event.sender.openDevTools(options);
+ break;
+ }
+ case "toggleDevTools":
+ event.sender.toggleDevTools();
break;
case "unregisterGlobalShortcut":
if (data.accelerator) {
@@ -2252,20 +2500,7 @@ app.whenReady().then(() => {
return;
}
const mainWindow = currentWorkspace.browserWindow;
- if (mainWindow.isMinimized()) {
- mainWindow.restore();
- mainWindow.show(); // 按 `Alt+M` 后隐藏窗口,再次按 `Alt+M` 显示窗口后会卡住不能编辑 https://github.com/siyuan-note/siyuan/issues/8456
- } else {
- if (mainWindow.isVisible()) {
- if (!mainWindow.isFocused()) {
- mainWindow.show();
- } else {
- hideWindow(mainWindow);
- }
- } else {
- mainWindow.show();
- }
- }
+ toggleMainWindow(mainWindow);
if ("win32" === process.platform || "linux" === process.platform) {
resetTrayMenu(currentWorkspace.tray, data.languages, mainWindow);
}
diff --git a/app/electron/window.js b/app/electron/window.js
index adb4c9fdf8..19161d7251 100644
--- a/app/electron/window.js
+++ b/app/electron/window.js
@@ -1,6 +1,6 @@
// 桌面端 pre-boot 窗口(init.html / workspace.html)共享脚本
// 由各 HTML 通过 <script src="window.js"></script> 引入,依赖 nodeIntegration: true
-// 中文用 ld246.com,其他语言用 liuyun.io
+// 简体中文用 ld246.com,其他语言用 liuyun.io
"use strict";
// 解析 URL query 参数
@@ -73,8 +73,8 @@ const I18N_BASE = {
feedback: "求助回饋建議",
community: "使用者社群匯總",
download: "下載最新版",
- feedbackUrl: "https://ld246.com/article/1649901726096",
- communityUrl: "https://ld246.com/article/1640266171309",
+ feedbackUrl: "https://liuyun.io/article/1686530886208",
+ communityUrl: "https://liuyun.io/article/1687779743723",
downloadUrl: "https://b3log.org/siyuan/download.html",
msgPartitionRoot: "⚠️ 請勿在分區根路徑上建立工作空間,請新增一個資料夾作為工作空間",
msgNotEmpty: "⚠️ 該資料夾包含了其他檔案,請新增一個資料夾作為工作空間",
diff --git a/app/src/boot/globalEvent/commonHotkey.ts b/app/src/boot/globalEvent/commonHotkey.ts
index 14cfaafa88..6a93b8c12e 100644
--- a/app/src/boot/globalEvent/commonHotkey.ts
+++ b/app/src/boot/globalEvent/commonHotkey.ts
@@ -153,11 +153,72 @@ export const correctHotkey = (app: App) => {
}, () => {
/// #if !BROWSER
sendGlobalShortcut(app);
+ syncAppMenuShortcuts();
/// #endif
});
}
};
+let lastHotkeys: Record<string, string>;
+
+export const syncAppMenuShortcuts = () => {
+ /// #if !BROWSER
+ if (!isMac()) {
+ return;
+ }
+ const appMenuHotkeyItems: Record<string, IKeymapItem> = {
+ config: window.siyuan.config.keymap.general.config,
+ toggleWin: window.siyuan.config.keymap.general.toggleWin,
+ undo: window.siyuan.config.keymap.editor.general.undo,
+ redo: window.siyuan.config.keymap.editor.general.redo,
+ };
+ const hotkey: Record<string, string> = {};
+ Object.keys(appMenuHotkeyItems).forEach(id => {
+ const item = appMenuHotkeyItems[id];
+ hotkey[id] = item.custom ?? item.default ?? "";
+ });
+ if (lastHotkeys && Object.keys(appMenuHotkeyItems).every(id => lastHotkeys[id] === hotkey[id])) {
+ return;
+ }
+ lastHotkeys = {...hotkey};
+ ipcRenderer.send(Constants.SIYUAN_SYNC_APP_MENU, {
+ workspaceDir: window.siyuan.config.system.workspaceDir,
+ lang: window.siyuan.config.lang,
+ readonly: window.siyuan.config.readonly,
+ hotkey,
+ i18n: {
+ config: window.siyuan.languages.config,
+ about: window.siyuan.languages.appMenuAbout,
+ services: window.siyuan.languages.appMenuServices,
+ toggleMainWindow: window.siyuan.languages.toggleWin,
+ hide: window.siyuan.languages.appMenuHide,
+ hideOthers: window.siyuan.languages.appMenuHideOthers,
+ showAll: window.siyuan.languages.showAll,
+ quit: window.siyuan.languages.appMenuQuit,
+ edit: window.siyuan.languages.edit,
+ undo: window.siyuan.languages.undo,
+ redo: window.siyuan.languages.redo,
+ cut: window.siyuan.languages.cut,
+ copy: window.siyuan.languages.copy,
+ paste: window.siyuan.languages.paste,
+ pasteAndMatchStyle: window.siyuan.languages.appMenuPasteAndMatchStyle,
+ selectAll: window.siyuan.languages.selectAll,
+ window: window.siyuan.languages.appMenuWindow,
+ minimize: window.siyuan.languages.appMenuMinimize,
+ zoom: window.siyuan.languages.zoom,
+ togglefullscreen: window.siyuan.languages.appMenuTogglefullscreen,
+ help: window.siyuan.languages.help,
+ userGuide: window.siyuan.languages.userGuide,
+ feedback: window.siyuan.languages.feedback,
+ debug: window.siyuan.languages.debug,
+ officialWebsite: window.siyuan.languages._trayMenu.officialWebsite,
+ openSource: window.siyuan.languages._trayMenu.openSource,
+ bringAllToFront: window.siyuan.languages.appMenuBringAllToFront,
+ },
+ });
+ /// #endif
+};
+
export const filterHotkey = (event: KeyboardEvent, app: App) => {
// https://github.com/siyuan-note/siyuan/issues/9848 忘记为什么要阻止了 .av__mask 的情况,测了下没问题就先移除
if (document.getElementById("progress") || document.getElementById("errorLog") || event.isComposing) {
diff --git a/app/src/boot/onGetConfig.ts b/app/src/boot/onGetConfig.ts
index 60c1433357..614074d92d 100644
--- a/app/src/boot/onGetConfig.ts
+++ b/app/src/boot/onGetConfig.ts
@@ -23,12 +23,14 @@ import {initStatus} from "../layout/status";
import {showMessage} from "../dialog/message";
import {replaceLocalPath} from "../editor/rename";
import {initBar} from "../layout/topBar";
+import {openSetting} from "../config";
+import {mountHelp} from "../util/mount";
import {openChangelog} from "./openChangelog";
import type {App} from "../index";
import {initWindowEvent} from "./globalEvent/event";
import {sendGlobalShortcut} from "./globalEvent/keydown";
import {closeWindow} from "../window/closeWin";
-import {correctHotkey} from "./globalEvent/commonHotkey";
+import {correctHotkey, syncAppMenuShortcuts} from "./globalEvent/commonHotkey";
import {recordBeforeResizeTop} from "../protyle/util/resize";
import {processSiYuanUri} from "../util/uri";
import {getAllEditor} from "../layout/getAll";
@@ -187,6 +189,12 @@ export const initWindow = async (app: App) => {
}
openFile(data);
});
+ ipcRenderer.on(Constants.SIYUAN_OPEN_SETTING, () => {
+ openSetting(app);
+ });
+ ipcRenderer.on(Constants.SIYUAN_OPEN_HELP, () => {
+ mountHelp();
+ });
ipcRenderer.on(Constants.SIYUAN_SAVE_CLOSE, (event, close) => {
if (isWindow()) {
closeWindow(app);
@@ -404,6 +412,7 @@ ${response.data.replace("%pages", "<span class=totalPages></span>").replace("%pa
}
});
}
+ syncAppMenuShortcuts();
/// #else
if (!isWindow()) {
document.querySelector(".toolbar").classList.add("toolbar--browser");
diff --git a/app/src/config/tabs/keymapUi.ts b/app/src/config/tabs/keymapUi.ts
index f0dbc3e44e..506ad331b8 100644
--- a/app/src/config/tabs/keymapUi.ts
+++ b/app/src/config/tabs/keymapUi.ts
@@ -10,6 +10,7 @@ import {exportLayout} from "../../layout/util";
import {updateDockHotkeys} from "../../layout/dock/util";
import {confirmDialog} from "../../dialog/confirmDialog";
import {sendGlobalShortcut, sendUnregisterGlobalShortcut} from "../../boot/globalEvent/keydown";
+import {syncAppMenuShortcuts} from "../../boot/globalEvent/commonHotkey";
import {normalizeSearchText} from "../search/normalize";
import {genButtonRowHtml, genConfigGroup} from "../render/render";
import type {Plugin} from "../../plugin";
@@ -671,6 +672,7 @@ const setKeymapFromDom = (root: HTMLElement) => {
});
}
sendGlobalShortcut(window.siyuan.ws.app);
+ syncAppMenuShortcuts();
/// #endif
});
};
diff --git a/app/src/constants.ts b/app/src/constants.ts
index 9bb9583664..339f23ea0b 100644
--- a/app/src/constants.ts
+++ b/app/src/constants.ts
@@ -40,16 +40,14 @@ export abstract class Constants {
public static readonly SIYUAN_QUIT: string = "siyuan-quit";
public static readonly SIYUAN_INSTALL_UPDATE: string = "siyuan-install-update";
public static readonly SIYUAN_HOTKEY: string = "siyuan-hotkey";
+ public static readonly SIYUAN_SYNC_APP_MENU: string = "siyuan-sync-app-menu";
public static readonly SIYUAN_INIT: string = "siyuan-init";
public static readonly SIYUAN_READY_TO_SHOW: string = "siyuan-ready-to-show";
public static readonly SIYUAN_SEND_WINDOWS: string = "siyuan-send-windows"; // 主窗口和各新窗口之间的通信
- public static readonly SIYUAN_SAVE_CLOSE: string = "siyuan-save-close";
public static readonly SIYUAN_AUTO_LAUNCH: string = "siyuan-auto-launch";
public static readonly SIYUAN_OPEN_WORKSPACE: string = "siyuan-open-workspace";
- public static readonly SIYUAN_OPEN_URL: string = "siyuan-open-url";
public static readonly SIYUAN_OPEN_WINDOW: string = "siyuan-open-window";
- public static readonly SIYUAN_OPEN_FILE: string = "siyuan-open-file";
public static readonly SIYUAN_EXPORT_PDF: string = "siyuan-export-pdf";
public static readonly SIYUAN_EXPORT_NEWWINDOW: string = "siyuan-export-newwindow";
@@ -62,6 +60,13 @@ export abstract class Constants {
public static readonly SIYUAN_SHOW_WINDOW: string = "siyuan-show-window";
+ // 主进程调渲染进程
+ public static readonly SIYUAN_OPEN_URL: string = "siyuan-open-url";
+ public static readonly SIYUAN_OPEN_FILE: string = "siyuan-open-file";
+ public static readonly SIYUAN_SAVE_CLOSE: string = "siyuan-save-close";
+ public static readonly SIYUAN_OPEN_SETTING: string = "siyuan-open-setting";
+ public static readonly SIYUAN_OPEN_HELP: string = "siyuan-open-help";
+
// custom
public static readonly CUSTOM_REMINDER_WECHAT: string = "custom-reminder-wechat";
public static readonly CUSTOM_RIFF_DECKS: string = "custom-riff-decks";
diff --git a/app/src/layout/status.ts b/app/src/layout/status.ts
index 30efc6b0b6..e8ff0ace43 100644
--- a/app/src/layout/status.ts
+++ b/app/src/layout/status.ts
@@ -77,7 +77,7 @@ export const initStatus = (isWindow = false) => {
label: window.siyuan.languages.feedback,
icon: "iconFeedback",
click: () => {
- if ("zh-CN" === window.siyuan.config.lang || "zh-TW" === window.siyuan.config.lang) {
+ if ("zh-CN" === window.siyuan.config.lang) {
window.open("https://ld246.com/article/1649901726096");
} else {
window.open("https://liuyun.io/article/1686530886208");
@@ -89,7 +89,7 @@ export const initStatus = (isWindow = false) => {
label: window.siyuan.languages.debug,
icon: "iconBug",
click: () => {
- ipcRenderer.send(Constants.SIYUAN_CMD, "openDevTools");
+ ipcRenderer.send(Constants.SIYUAN_CMD, "toggleDevTools");
}
}).element);
/// #endif
diff --git a/app/src/menus/workspace.ts b/app/src/menus/workspace.ts
index fc7cbcf817..7b429e9da2 100644
--- a/app/src/menus/workspace.ts
+++ b/app/src/menus/workspace.ts
@@ -562,7 +562,7 @@ export const workspaceMenu = (app: App, rect: DOMRect) => {
label: window.siyuan.languages.feedback,
icon: "iconFeedback",
click: () => {
- if ("zh-CN" === window.siyuan.config.lang || "zh-TW" === window.siyuan.config.lang) {
+ if ("zh-CN" === window.siyuan.config.lang) {
window.open("https://ld246.com/article/1649901726096");
} else {
window.open("https://liuyun.io/article/1686530886208");
@@ -575,7 +575,7 @@ export const workspaceMenu = (app: App, rect: DOMRect) => {
label: window.siyuan.languages.debug,
icon: "iconBug",
click: () => {
- ipcRenderer.send(Constants.SIYUAN_CMD, "openDevTools");
+ ipcRenderer.send(Constants.SIYUAN_CMD, "toggleDevTools");
}
}).element);
/// #endif
diff --git a/app/src/mobile/menu/index.ts b/app/src/mobile/menu/index.ts
index 8d5409f3e3..0a26db2ad2 100644
--- a/app/src/mobile/menu/index.ts
+++ b/app/src/mobile/menu/index.ts
@@ -277,7 +277,7 @@ export const initRightMenu = (app: App) => {
<div class="b3-menu__item${window.siyuan.config.readonly ? " fn__none" : ""}" id="menuHelp">
<svg class="b3-menu__icon"><use xlink:href="#iconHelp"></use></svg><span class="b3-menu__label">${window.siyuan.languages.userGuide}</span>
</div>
- <a class="b3-menu__item" href="${"zh-CN" === window.siyuan.config.lang || "zh-TW" === window.siyuan.config.lang ? "https://ld246.com/article/1649901726096" : "https://liuyun.io/article/1686530886208"}" target="_blank">
+ <a class="b3-menu__item" href="${"zh-CN" === window.siyuan.config.lang ? "https://ld246.com/article/1649901726096" : "https://liuyun.io/article/1686530886208"}" target="_blank">
<svg class="b3-menu__icon"><use xlink:href="#iconFeedback"></use></svg>
<span class="b3-menu__label">${window.siyuan.languages.feedback}</span>
</a>