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/9666

Vanessa5c034d93d00d
diff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.ts
index 59b3df925e..15c75be2c0 100644
--- a/app/src/boot/globalEvent/keydown.ts
+++ b/app/src/boot/globalEvent/keydown.ts
@@ -1158,15 +1158,6 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {
}
if (matchHotKey(window.siyuan.config.keymap.general.recentDocs.custom, event)) {
- const openRecentDocsDialog = window.siyuan.dialogs.find(item => {
- if (item.element.getAttribute("data-key") === window.siyuan.config.keymap.general.recentDocs.custom) {
- return true;
- }
- });
- if (openRecentDocsDialog) {
- hideElements(["dialog"]);
- return;
- }
openRecentDocs();
event.preventDefault();
return;
diff --git a/app/src/business/openRecentDocs.ts b/app/src/business/openRecentDocs.ts
index 0cabea19fe..408d2abce4 100644
--- a/app/src/business/openRecentDocs.ts
+++ b/app/src/business/openRecentDocs.ts
@@ -8,8 +8,18 @@ import {getAllDocks} from "../layout/getAll";
import {Dialog} from "../dialog";
import {focusByRange} from "../protyle/util/selection";
import {hasClosestByClassName} from "../protyle/util/hasClosest";
+import {hideElements} from "../protyle/ui/hideElements";
export const openRecentDocs = () => {
+ const openRecentDocsDialog = window.siyuan.dialogs.find(item => {
+ if (item.element.getAttribute("data-key") === window.siyuan.config.keymap.general.recentDocs.custom) {
+ return true;
+ }
+ });
+ if (openRecentDocsDialog) {
+ hideElements(["dialog"]);
+ return;
+ }
fetchPost("/api/storage/getRecentDocs", {}, (response) => {
let range: Range;
if (getSelection().rangeCount > 0) {
diff --git a/app/src/layout/tabUtil.ts b/app/src/layout/tabUtil.ts
index 2c4cf4cfbb..fad0deb4b2 100644
--- a/app/src/layout/tabUtil.ts
+++ b/app/src/layout/tabUtil.ts
@@ -188,15 +188,6 @@ export const newCenterEmptyTab = (app: App) => {
event.preventDefault();
break;
} else if (target.id === "editorEmptyRecent") {
- const openRecentDocsDialog = window.siyuan.dialogs.find(item => {
- if (item.element.getAttribute("data-key") === window.siyuan.config.keymap.general.recentDocs.custom) {
- return true;
- }
- });
- if (openRecentDocsDialog) {
- hideElements(["dialog"]);
- return;
- }
openRecentDocs();
event.stopPropagation();
event.preventDefault();
diff --git a/app/src/menus/workspace.ts b/app/src/menus/workspace.ts
index 12dc0842cc..c03ab6172e 100644
--- a/app/src/menus/workspace.ts
+++ b/app/src/menus/workspace.ts
@@ -25,6 +25,7 @@ import {confirmDialog} from "../dialog/confirmDialog";
import {App} from "../index";
import {isBrowser} from "../util/functions";
import {unbindSaveUI} from "../boot/onGetConfig";
+import {openRecentDocs} from "../business/openRecentDocs";
const togglePinDock = (dock: Dock, icon: string) => {
return {
@@ -371,6 +372,14 @@ export const workspaceMenu = (app: App, rect: DOMRect) => {
}
}],
}).element);
+ window.siyuan.menus.menu.append(new MenuItem({
+ label: window.siyuan.languages.recentDocs,
+ icon: "iconFile",
+ accelerator: window.siyuan.config.keymap.general.recentDocs.custom,
+ click: () => {
+ openRecentDocs();
+ }
+ }).element);
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.lockScreen,
icon: "iconLock",