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

Vanessa4a9ee67891f7
diff --git a/app/src/config/about.ts b/app/src/config/about.ts
index a22c64b568..4fe0f821d4 100644
--- a/app/src/config/about.ts
+++ b/app/src/config/about.ts
@@ -190,8 +190,13 @@ export const about = {
const searchData = JSON.parse(localStorage.getItem(Constants.LOCAL_SEARCHEDATA) || "{}");
if (searchData.hPath) {
searchData.hPath = "";
+ searchData.idPath = "";
localStorage.setItem(Constants.LOCAL_SEARCHEDATA, JSON.stringify(searchData));
}
+ localStorage.removeItem(Constants.LOCAL_DAILYNOTEID);
+ localStorage.removeItem(Constants.LOCAL_DOCINFO);
+ localStorage.removeItem(Constants.LOCAL_HISTORYNOTEID);
+ localStorage.removeItem("pdfjs.history");
exportLayout(false, () => {
exitSiYuan();
});
diff --git a/app/src/config/keymap.ts b/app/src/config/keymap.ts
index 087f47b1e1..14daf4d0ec 100644
--- a/app/src/config/keymap.ts
+++ b/app/src/config/keymap.ts
@@ -268,7 +268,7 @@ export const keymap = {
}
if (["⌘", "⇧", "⌥", "⌃"].includes(keymapStr.substr(keymapStr.length - 1, 1)) ||
- ["⌘S", "⌘A", "⌘X", "⌘C", "⌘V", "⌘/", "⌘↑", "⌘↓", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⇧⌘⇥", "⌃⇥", "⌃⌘⇥", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦", "F9"].includes(keymapStr)) {
+ ["⌘S", "⌘A", "⌘X", "⌘C", "⌘V", "⌘/", "⌘↑", "⌘↓", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⌘⇥", "⌃⇥", "⌃⌘⇥", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦", "F9"].includes(keymapStr)) {
showMessage(tip + "] " + window.siyuan.languages.invalid);
return;
}
diff --git a/app/src/constants.ts b/app/src/constants.ts
index c64a295a31..7b15d93c40 100644
--- a/app/src/constants.ts
+++ b/app/src/constants.ts
@@ -82,7 +82,7 @@ export abstract class Constants {
};
// "⌘", "⇧", "⌥", "⌃"
- // "⌘S", "⌘A", "⌘X", "⌘C", "⌘V", "⌘/", "⌘↑", "⌘↓", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⇧⌘⇥", "⌃⇥", "⌃⌘⇥", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦", "F9" 不可自定义
+ // "⌘S", "⌘A", "⌘X", "⌘C", "⌘V", "⌘/", "⌘↑", "⌘↓", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⌘⇥", "⌃⇥", "⌃⌘⇥", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦", "F9" 不可自定义
public static readonly SIYUAN_KEYMAP: IKeymap = {
general: {
enterBack: {default: "⌥←", custom: "⌥←"},
diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts
index 15cd75ff22..96c3805943 100644
--- a/app/src/layout/util.ts
+++ b/app/src/layout/util.ts
@@ -25,6 +25,39 @@ import {getContenteditableElement} from "../protyle/wysiwyg/getBlock";
import {updatePanelByEditor} from "../editor/util";
import {Constants} from "../constants";
import {openSearch} from "../search/spread";
+import {Dialog} from "../dialog";
+import {isMobile} from "../util/functions";
+
+export const openCloseRecentTab = () => {
+ const recentClose = JSON.parse(localStorage.getItem(Constants.LOCAL_RECENTCLOSE) || "[]");
+ let html = ''
+ if (recentClose.length === 0) {
+ html += `<li class="b3-list-item b3-list--empty">${window.siyuan.languages.emptyContent}</li>`
+ } else {
+ recentClose.forEach((item: IObject) => {
+ html += `<li class="b3-list-item" data-instance="${item.instance}">${item.text}</li>`
+ })
+ }
+ const dialog = new Dialog({
+ title: window.siyuan.languages.recentClose,
+ content: `<div class="fn__flex-column" style="height: 100%;max-height: 70vh;">
+ <ul class="b3-list b3-list--background fn__flex-1">${html}</ul>
+ <div class="fn__hr"></div>
+</div>`,
+ width: isMobile() ? "80vw" : "50vw",
+ });
+ dialog.element.addEventListener("click", (event) => {
+ let target = event.target as HTMLElement
+ while (!target.isSameNode(dialog.element)) {
+ const instance = target.getAttribute("data-instance")
+ if (instance) {
+
+ break;
+ }
+ target = target.parentElement
+ }
+ })
+}
export const setPanelFocus = (element: Element) => {
if (element.classList.contains("block__icons--active") || element.classList.contains("layout__wnd--active")) {
@@ -245,7 +278,7 @@ const JSONToCenter = (json: any, layout?: Layout | Wnd | Tab | Model) => {
}));
} else if (json.instance === "Tag") {
(layout as Tab).addModel(new Tag((layout as Tab)));
- } else if (json.instance === "search") {
+ } else if (json.instance === "Search") {
(layout as Tab).addModel(new Search({
tab: (layout as Tab),
text: json.text
@@ -353,7 +386,7 @@ export const layoutToJSON = (layout: Layout | Wnd | Tab | Model, json: any) => {
} else if (layout instanceof Tag) {
json.instance = "Tag";
} else if (layout instanceof Search) {
- json.instance = "search";
+ json.instance = "Search";
json.text = layout.text;
}
diff --git a/app/src/menus/tab.ts b/app/src/menus/tab.ts
index ea3086292a..924b896354 100644
--- a/app/src/menus/tab.ts
+++ b/app/src/menus/tab.ts
@@ -111,7 +111,6 @@ const closeMenu = (model: Model) => {
}).element);
}
}
-
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
};