An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: fix https://github.com/siyuan-note/siyuan/issues/6919
Vanessa0153d9b8d707
diff --git a/app/src/constants.ts b/app/src/constants.tsindex 071f05f5ad..ce134069e8 100644--- a/app/src/constants.ts+++ b/app/src/constants.ts@@ -59,7 +59,7 @@ export abstract class Constants {// localstoragepublic static readonly LOCAL_SEARCHEDATA = "local-searchedata";- public static readonly LOCAL_SEARCHEKEYS = "local-searchekeys"; // "keys","col", "row", "replaceKeys"+ public static readonly LOCAL_SEARCHEKEYS = "local-searchekeys"; // "keys", "col", "row", "replaceKeys", "layout"public static readonly LOCAL_DOCINFO = "local-docinfo"; // only mobilepublic static readonly LOCAL_DAILYNOTEID = "local-dailynoteid";public static readonly LOCAL_HISTORYNOTEID = "local-historynoteid";diff --git a/app/src/search/spread.ts b/app/src/search/spread.tsindex 241258f5cf..15b84cbda3 100644--- a/app/src/search/spread.ts+++ b/app/src/search/spread.ts@@ -109,7 +109,6 @@ export const openSearch = async (hotkey: string, key?: string, notebookId?: strihPath,idPath,group: localData.group || 0,- layout: localData.layout || 0,sort: localData.sort || 0,types: localData.types}, dialog.element.querySelector(".b3-dialog__container").lastElementChild, () => {diff --git a/app/src/search/util.ts b/app/src/search/util.tsindex 5bb151c32d..479b0084dd 100644--- a/app/src/search/util.ts+++ b/app/src/search/util.ts@@ -78,7 +78,6 @@ export const openGlobalSearch = (text: string, replace: boolean) => {hPath: "",idPath: [],group: localData.group || 0,- layout: localData.layout || 0,sort: localData.sort || 0,types: localData.types}@@ -110,6 +109,7 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: ()enableIncludeChild = true;}});+ const data = JSON.parse(localStorage.getItem(Constants.LOCAL_SEARCHEKEYS) || "{}");element.innerHTML = `<div class="fn__flex-column" style="height: 100%;${closeCB ? "border-radius: 4px;overflow: hidden;" : ""}"><div class="b3-form__icon search__header"><span class="fn__a" id="searchHistoryBtn">@@ -181,7 +181,7 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: ()</span></div></div>- <div class="search__layout${config.layout === 1 ? " search__layout--row" : ""}">+ <div class="search__layout${data.layout === 1 ? " search__layout--row" : ""}"><div id="searchList" class="fn__flex-1 search__list b3-list b3-list--background"></div><div class="search__drag"></div><div id="searchPreview" class="fn__flex-1 search__preview"></div>@@ -202,9 +202,7 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: ()breadcrumbDocName: true},});-- const data = JSON.parse(localStorage.getItem(Constants.LOCAL_SEARCHEKEYS) || "{}");- if (config.layout === 1) {+ if (data.layout === 1) {if (data.col) {edit.protyle.element.style.width = data.col;edit.protyle.element.classList.remove("fn__flex-1");@@ -227,7 +225,7 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: ()const documentSelf = document;const nextElement = dragElement.nextElementSibling as HTMLElement;const previousElement = dragElement.previousElementSibling as HTMLElement;- const direction = config.layout === 1 ? "lr" : "tb";+ const direction = JSON.parse(localStorage.getItem(Constants.LOCAL_SEARCHEKEYS) || "{}").layout === 1 ? "lr" : "tb";const x = event[direction === "lr" ? "clientX" : "clientY"];const previousSize = direction === "lr" ? previousElement.clientWidth : previousElement.clientHeight;const nextSize = direction === "lr" ? nextElement.clientWidth : nextElement.clientHeight;@@ -706,40 +704,44 @@ const addConfigMoreMenu = async (config: ISearchOption, edit: Protyle, element:}}]}).element);+ const localData = JSON.parse(localStorage.getItem(Constants.LOCAL_SEARCHEKEYS) || "{}")+ if (typeof localData.layout === "undefined") {+ localData.layout = 0;+ }window.siyuan.menus.menu.append(new MenuItem({label: window.siyuan.languages.layout,type: "submenu",submenu: [{label: window.siyuan.languages.topBottomLayout,- current: config.layout === 0,+ current: localData.layout === 0,click() {element.querySelector(".search__layout").classList.remove("search__layout--row");edit.protyle.element.style.width = "";- const data = JSON.parse(localStorage.getItem(Constants.LOCAL_SEARCHEKEYS) || "{}");- if (data.row) {- edit.protyle.element.style.height = data.row;+ if (localData.row) {+ edit.protyle.element.style.height = localData.row;edit.protyle.element.classList.remove("fn__flex-1");} else {edit.protyle.element.classList.add("fn__flex-1");}setPadding(edit.protyle);- config.layout = 0;+ localData.layout = 0;+ localStorage.setItem(Constants.LOCAL_SEARCHEKEYS, JSON.stringify(localData));}}, {label: window.siyuan.languages.leftRightLayout,- current: config.layout === 1,+ current: localData.layout === 1,click() {element.querySelector(".search__layout").classList.add("search__layout--row");edit.protyle.element.style.height = "";- const data = JSON.parse(localStorage.getItem(Constants.LOCAL_SEARCHEKEYS) || "{}");- if (data.col) {- edit.protyle.element.style.width = data.col;+ if (localData.col) {+ edit.protyle.element.style.width = localData.col;edit.protyle.element.classList.remove("fn__flex-1");} else {edit.protyle.element.classList.add("fn__flex-1");}setPadding(edit.protyle);- config.layout = 1;+ localData.layout = 1;+ localStorage.setItem(Constants.LOCAL_SEARCHEKEYS, JSON.stringify(localData));}}]}).element);@@ -814,7 +816,6 @@ const addConfigMoreMenu = async (config: ISearchOption, edit: Protyle, element:updateConfig(element, {sort: 0,group: 0,- layout: 0,hasReplace: false,method: 0,hPath: "",@@ -847,29 +848,6 @@ const updateConfig = (element: Element, item: ISearchOption, config: ISearchOptiitem.hPath = config.hPath;item.idPath = config.idPath.join(",").split(",");}- if (config.layout !== item.layout) {- const data = JSON.parse(localStorage.getItem(Constants.LOCAL_SEARCHEKEYS) || "{}");- if (item.layout === 0) {- element.querySelector(".search__layout").classList.remove("search__layout--row");- if (data.row) {- edit.protyle.element.classList.remove("fn__flex-1");- edit.protyle.element.style.height = data.row;- edit.protyle.element.style.width = "";- } else {- edit.protyle.element.classList.add("fn__flex-1");- }- } else {- element.querySelector(".search__layout").classList.add("search__layout--row");- if (data.col) {- edit.protyle.element.style.width = data.col;- edit.protyle.element.classList.remove("fn__flex-1");- edit.protyle.element.style.height = "";- } else {- edit.protyle.element.classList.add("fn__flex-1");- }- }- setPadding(edit.protyle);- }if (config.hasReplace !== item.hasReplace) {if (item.hasReplace) {element.querySelector("#replaceHistoryBtn").parentElement.classList.remove("fn__none");diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.tsindex c9d4799f7e..da0e5cd0ab 100644--- a/app/src/types/index.d.ts+++ b/app/src/types/index.d.ts@@ -61,7 +61,6 @@ interface ISearchOption {name?: stringsort: number, // 0:按块类型(默认),1:按创建时间升序,2:按创建时间降序,3:按更新时间升序,4:按更新时间降序,5:按内容顺序(仅在按文档分组时),6:按相关度升序,7:按相关度降序group: number, // 0:不分组,1:按文档分组- layout: number // 0:上下,1:左右hasReplace: boolean,method: number // 0:文本,1:查询语法,2:SQL,3:正则表达式hPath: string