An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
Fix type errors related to `siyuan.config` (#10724)
Yingyi / 颖逸6b2ac5e630ea
diff --git a/app/src/boot/globalEvent/searchKeydown.ts b/app/src/boot/globalEvent/searchKeydown.tsindex cb2595360e..43770bdb3a 100644--- a/app/src/boot/globalEvent/searchKeydown.ts+++ b/app/src/boot/globalEvent/searchKeydown.ts@@ -30,7 +30,7 @@ export const searchKeydown = (app: App, event: KeyboardEvent) => {let dialog: Dialog;let edit;let unRefEdit;- let config: ISearchOption;+ let config: Config.IUILayoutTabSearchConfig;window.siyuan.dialogs.find((item) => {if (item.element.contains(range.startContainer) && item.element.querySelector("#searchList")) {element = item.element.querySelector(".b3-dialog__body");diff --git a/app/src/boot/onGetConfig.ts b/app/src/boot/onGetConfig.tsindex 734da944ea..a746e8240c 100644--- a/app/src/boot/onGetConfig.ts+++ b/app/src/boot/onGetConfig.ts@@ -29,10 +29,10 @@ import {sendGlobalShortcut} from "./globalEvent/keydown";import {closeWindow} from "../window/closeWin";import {checkFold} from "../util/noRelyPCFunction";-const matchKeymap = (keymap: Record<string, IKeymapItem>, key1: "general" | "editor", key2?: "general" | "insert" | "heading" | "list" | "table") => {+const matchKeymap = (keymap: Config.IKeys, key1: "general" | "editor", key2?: "general" | "insert" | "heading" | "list" | "table") => {if (key1 === "general") {if (!window.siyuan.config.keymap[key1]) {- window.siyuan.config.keymap[key1] = keymap;+ window.siyuan.config.keymap[key1] = keymap as Config.IKeymapGeneral;return false;}} else {@@ -41,7 +41,7 @@ const matchKeymap = (keymap: Record<string, IKeymapItem>, key1: "general" | "edireturn false;}if (!window.siyuan.config.keymap[key1][key2]) {- window.siyuan.config.keymap[key1][key2] = keymap;+ (window.siyuan.config.keymap[key1][key2] as Config.IKeymapEditor[typeof key2]) = keymap as Config.IKeymapEditor[typeof key2];return false;}}diff --git a/app/src/config/about.ts b/app/src/config/about.tsindex 5d8c11a4ee..3d3f52d173 100644--- a/app/src/config/about.ts+++ b/app/src/config/about.ts@@ -354,7 +354,7 @@ export const about = {});/// #endifabout.element.querySelector("#aboutConfirm").addEventListener("click", () => {- const scheme = (about.element.querySelector("#aboutScheme") as HTMLInputElement).value;+ const scheme = (about.element.querySelector("#aboutScheme") as HTMLInputElement).value as Config.TSystemNetworkProxyScheme;const host = (about.element.querySelector("#aboutHost") as HTMLInputElement).value;const port = (about.element.querySelector("#aboutPort") as HTMLInputElement).value;fetchPost("/api/system/setNetworkProxy", {scheme, host, port}, async () => {diff --git a/app/src/config/keymap.ts b/app/src/config/keymap.tsindex 277aa97bd6..d20d05a785 100644--- a/app/src/config/keymap.ts+++ b/app/src/config/keymap.ts@@ -12,7 +12,7 @@ import {sendGlobalShortcut} from "../boot/globalEvent/keydown";export const keymap = {element: undefined as Element,- _genItem(keymap: Record<string, IKeymapItem>, keys: string) {+ _genItem(keymap: Record<string, Config.IKey>, keys: string) {let html = "";Object.keys(keymap).forEach(key => {if (window.siyuan.languages[key]) {diff --git a/app/src/constants.ts b/app/src/constants.tsindex 929dbe8398..7b8ad9715f 100644--- a/app/src/constants.ts+++ b/app/src/constants.ts@@ -451,7 +451,7 @@ export abstract class Constants {plugin: {},};- public static readonly SIYUAN_EMPTY_LAYOUT: Record<string, unknown> = {+ public static readonly SIYUAN_EMPTY_LAYOUT: Config.IUiLayout = {hideDock: false,layout: {"direction": "tb",@@ -482,7 +482,14 @@ export abstract class Constants {"size": "auto","type": "center","instance": "Layout",- "children": [{"instance": "Wnd", "children": [{"instance": "Tab", "children": []}]}]+ "children": [{+ "instance": "Wnd",+ "children": [],+ // "children": [{+ // "instance": "Tab",+ // "children": []+ // }]+ }]}, {"direction": "tb","size": "0px",@@ -580,9 +587,7 @@ export abstract class Constants {}};- public static readonly SIYUAN_DEFAULT_REPLACETYPES: {- [key: string]: boolean;- } = {+ public static readonly SIYUAN_DEFAULT_REPLACETYPES: Required<Config.IUILayoutTabSearchConfigReplaceTypes> = {"text": true,"imgText": true,"imgTitle": true,diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.tsindex 4063ec6bc6..df66374fff 100644--- a/app/src/layout/Wnd.ts+++ b/app/src/layout/Wnd.ts@@ -47,9 +47,9 @@ export class Wnd {public element: HTMLElement;public headersElement: HTMLElement;public children: Tab[] = [];- public resize?: TDirection;+ public resize?: Config.TUILayoutDirection;- constructor(app: App, resize?: TDirection, parentType?: TLayout) {+ constructor(app: App, resize?: Config.TUILayoutDirection, parentType?: Config.TUILayoutType) {this.id = genUUID();this.app = app;this.resize = resize;@@ -896,7 +896,7 @@ export class Wnd {/// #endif}- public split(direction: TDirection) {+ public split(direction: Config.TUILayoutDirection) {if (this.children.length === 1 && !this.children[0].headElement) {// 场景:没有打开的文档,点击标签面板打开return this;diff --git a/app/src/layout/dock/index.ts b/app/src/layout/dock/index.tsindex 0e536d47e2..9c7b3f3161 100644--- a/app/src/layout/dock/index.ts+++ b/app/src/layout/dock/index.ts@@ -35,7 +35,7 @@ export class Dock {app: App,data: {pin: boolean,- data: IDockTab[][]+ data: Config.IUILayoutDockTab[][]},position: TDockPosition}) {@@ -679,7 +679,7 @@ export class Dock {return max;}- public genButton(data: IDockTab[], index: number, tabIndex?: number) {+ public genButton(data: Config.IUILayoutDockTab[], index: number, tabIndex?: number) {let html = "";data.forEach(item => {if (typeof tabIndex === "undefined" && !TYPES.includes(item.type)) {diff --git a/app/src/layout/getAll.ts b/app/src/layout/getAll.tsindex 21e3576f32..ef51f90368 100644--- a/app/src/layout/getAll.ts+++ b/app/src/layout/getAll.ts@@ -131,19 +131,19 @@ export const getAllTabs = () => {};export const getAllDocks = () => {- const docks: IDockTab[] = [];- window.siyuan.config.uiLayout.left.data.forEach((item: IDockTab[]) => {- item.forEach((dock: IDockTab) => {+ const docks: Config.IUILayoutDockTab[] = [];+ window.siyuan.config.uiLayout.left.data.forEach((item) => {+ item.forEach((dock) => {docks.push(dock);});});- window.siyuan.config.uiLayout.right.data.forEach((item: IDockTab[]) => {- item.forEach((dock: IDockTab) => {+ window.siyuan.config.uiLayout.right.data.forEach((item) => {+ item.forEach((dock) => {docks.push(dock);});});- window.siyuan.config.uiLayout.bottom.data.forEach((item: IDockTab[]) => {- item.forEach((dock: IDockTab) => {+ window.siyuan.config.uiLayout.bottom.data.forEach((item) => {+ item.forEach((dock) => {docks.push(dock);});});diff --git a/app/src/layout/index.ts b/app/src/layout/index.tsindex cf7512ddef..2a6f5a7959 100644--- a/app/src/layout/index.ts+++ b/app/src/layout/index.ts@@ -11,14 +11,14 @@ export class Layout {public element: HTMLElement;public children?: Array<Layout | Wnd>;public parent?: Layout;- public direction: TDirection;- public type?: TLayout;+ public direction: Config.TUILayoutDirection;+ public type?: Config.TUILayoutType;public id?: string;- public resize?: TDirection;+ public resize?: Config.TUILayoutDirection;public size?: string;constructor(options?: ILayoutOptions) {- const mergedOptions = Object.assign({+ const mergedOptions: ILayoutOptions = Object.assign({direction: "tb",size: "auto",type: "normal"diff --git a/app/src/layout/util.ts b/app/src/layout/util.tsindex 1e3d64ee83..e39e389ca5 100644--- a/app/src/layout/util.ts+++ b/app/src/layout/util.ts@@ -1,39 +1,39 @@-import {Layout} from "./index";-import {Wnd} from "./Wnd";-import {Tab} from "./Tab";-import {Model} from "./Model";-import {Graph} from "./dock/Graph";-import {Editor} from "../editor";-import {Files} from "./dock/Files";-import {Outline} from "./dock/Outline";-import {Bookmark} from "./dock/Bookmark";-import {Tag} from "./dock/Tag";-import {getAllModels, getAllTabs} from "./getAll";-import {Asset} from "../asset";-import {Search} from "../search";-import {Dock} from "./dock";-import {focusByOffset, focusByRange, getSelectionOffset} from "../protyle/util/selection";-import {hideElements} from "../protyle/ui/hideElements";-import {fetchPost} from "../util/fetch";-import {hasClosestBlock, hasClosestByClassName} from "../protyle/util/hasClosest";-import {getContenteditableElement} from "../protyle/wysiwyg/getBlock";-import {Constants} from "../constants";-import {saveScroll} from "../protyle/scroll/saveScroll";-import {Backlink} from "./dock/Backlink";-import {openFileById} from "../editor/util";-import {isWindow} from "../util/functions";+import { Layout } from "./index";+import { Wnd } from "./Wnd";+import { Tab } from "./Tab";+import { Model } from "./Model";+import { Graph } from "./dock/Graph";+import { Editor } from "../editor";+import { Files } from "./dock/Files";+import { Outline } from "./dock/Outline";+import { Bookmark } from "./dock/Bookmark";+import { Tag } from "./dock/Tag";+import { getAllModels, getAllTabs } from "./getAll";+import { Asset } from "../asset";+import { Search } from "../search";+import { Dock } from "./dock";+import { focusByOffset, focusByRange, getSelectionOffset } from "../protyle/util/selection";+import { hideElements } from "../protyle/ui/hideElements";+import { fetchPost } from "../util/fetch";+import { hasClosestBlock, hasClosestByClassName } from "../protyle/util/hasClosest";+import { getContenteditableElement } from "../protyle/wysiwyg/getBlock";+import { Constants } from "../constants";+import { saveScroll } from "../protyle/scroll/saveScroll";+import { Backlink } from "./dock/Backlink";+import { openFileById } from "../editor/util";+import { isWindow } from "../util/functions";/// #if !BROWSER-import {setTabPosition} from "../window/setHeader";+import { setTabPosition } from "../window/setHeader";/// #endif-import {showMessage} from "../dialog/message";-import {getIdZoomInByPath} from "../util/pathName";-import {Custom} from "./dock/Custom";-import {newCardModel} from "../card/newCardTab";-import {App} from "../index";-import {afterLoadPlugin} from "../plugin/loader";-import {setTitle} from "../dialog/processSystem";-import {newCenterEmptyTab, resizeTabs} from "./tabUtil";-import {setStorageVal} from "../protyle/util/compatibility";+import { showMessage } from "../dialog/message";+import { getIdZoomInByPath } from "../util/pathName";+import { Custom } from "./dock/Custom";+import { newCardModel } from "../card/newCardTab";+import { App } from "../index";+import { afterLoadPlugin } from "../plugin/loader";+import { setTitle } from "../dialog/processSystem";+import { newCenterEmptyTab, resizeTabs } from "./tabUtil";+import { setStorageVal } from "../protyle/util/compatibility";export const setPanelFocus = (element: Element) => {if (element.getAttribute("data-type") === "wnd") {@@ -136,7 +136,7 @@ export const getWndByLayout: (layout: Layout) => Wnd = (layout: Layout) => {const dockToJSON = (dock: Dock) => {const json = [];const subDockToJSON = (index: number) => {- const data: IDockTab[] = [];+ const data: Config.IUILayoutDockTab[] = [];dock.element.querySelectorAll(`span[data-index="${index}"]`).forEach(item => {data.push({type: item.getAttribute("data-type"),@@ -169,7 +169,7 @@ const dockToJSON = (dock: Dock) => {};export const resetLayout = () => {- fetchPost("/api/system/setUILayout", {layout: {}}, () => {+ fetchPost("/api/system/setUILayout", { layout: {} }, () => {window.siyuan.storage[Constants.LOCAL_FILEPOSITION] = {};setStorageVal(Constants.LOCAL_FILEPOSITION, window.siyuan.storage[Constants.LOCAL_FILEPOSITION]);window.siyuan.storage[Constants.LOCAL_DIALOGPOSITION] = {};@@ -270,7 +270,7 @@ export const getAllLayout = () => {return layoutJSON;};-const initInternalDock = (dockItem: IDockTab[]) => {+const initInternalDock = (dockItem: Config.IUILayoutDockTab[]) => {dockItem.forEach((existSubItem) => {if (existSubItem.hotkeyLangId) {existSubItem.title = window.siyuan.languages[existSubItem.hotkeyLangId];@@ -280,22 +280,26 @@ const initInternalDock = (dockItem: IDockTab[]) => {};const JSONToDock = (json: any, app: App) => {- json.left.data.forEach((existItem: IDockTab[]) => {+ json.left.data.forEach((existItem: Config.IUILayoutDockTab[]) => {initInternalDock(existItem);});- json.right.data.forEach((existItem: IDockTab[]) => {+ json.right.data.forEach((existItem: Config.IUILayoutDockTab[]) => {initInternalDock(existItem);});- json.bottom.data.forEach((existItem: IDockTab[]) => {+ json.bottom.data.forEach((existItem: Config.IUILayoutDockTab[]) => {initInternalDock(existItem);});window.siyuan.layout.centerLayout = window.siyuan.layout.layout.children[0].children[1] as Layout;- window.siyuan.layout.leftDock = new Dock({position: "Left", data: json.left, app});- window.siyuan.layout.rightDock = new Dock({position: "Right", data: json.right, app});- window.siyuan.layout.bottomDock = new Dock({position: "Bottom", data: json.bottom, app});+ window.siyuan.layout.leftDock = new Dock({ position: "Left", data: json.left, app });+ window.siyuan.layout.rightDock = new Dock({ position: "Right", data: json.right, app });+ window.siyuan.layout.bottomDock = new Dock({ position: "Bottom", data: json.bottom, app });};-export const JSONToCenter = (app: App, json: ILayoutJSON, layout?: Layout | Wnd | Tab | Model) => {+export const JSONToCenter = (+ app: App,+ json: Config.TUILayoutItem,+ layout?: Layout | Wnd | Tab | Model,+) => {let child: Layout | Wnd | Tab | Model;if (json.instance === "Layout") {if (!layout) {@@ -408,7 +412,7 @@ export const JSONToCenter = (app: App, json: ILayoutJSON, layout?: Layout | Wnd}(layout as Tab).headElement.setAttribute("data-initdata", JSON.stringify(json));}- if (json.children) {+ if ("children" in json) {if (Array.isArray(json.children)) {json.children.forEach((item: any) => {JSONToCenter(app, item, layout ? child : window.siyuan.layout.layout);diff --git a/app/src/mobile/menu/search.ts b/app/src/mobile/menu/search.tsindex d0de71a653..b05a334418 100644--- a/app/src/mobile/menu/search.ts+++ b/app/src/mobile/menu/search.ts@@ -27,7 +27,7 @@ import {addClearButton} from "../../util/addClearButton";import {checkFold} from "../../util/noRelyPCFunction";import {getDefaultType} from "../../search/getDefault";-const replace = (element: Element, config: ISearchOption, isAll: boolean) => {+const replace = (element: Element, config: Config.IUILayoutTabSearchConfig, isAll: boolean) => {if (config.method === 1 || config.method === 2) {showMessage(window.siyuan.languages._kernel[132]);return;@@ -106,7 +106,7 @@ const replace = (element: Element, config: ISearchOption, isAll: boolean) => {});};-const updateConfig = (element: Element, newConfig: ISearchOption, config: ISearchOption) => {+const updateConfig = (element: Element, newConfig: Config.IUILayoutTabSearchConfig, config: Config.IUILayoutTabSearchConfig) => {if (config.hasReplace !== newConfig.hasReplace) {if (newConfig.hasReplace) {element.querySelector('[data-type="toggle-replace"]').classList.add("toolbar__icon--active");@@ -162,7 +162,7 @@ const updateConfig = (element: Element, newConfig: ISearchOption, config: ISearcwindow.siyuan.menus.menu.remove();};-const onRecentBlocks = (data: IBlock[], config: ISearchOption, response?: IWebSocketData) => {+const onRecentBlocks = (data: IBlock[], config: Config.IUILayoutTabSearchConfig, response?: IWebSocketData) => {const listElement = document.querySelector("#searchList");let resultHTML = "";data.forEach((item: IBlock, index: number) => {@@ -212,7 +212,7 @@ ${unicode2Emoji(childItem.ial.icon, "b3-list-item__graphic", true)}};let toolbarSearchTimeout = 0;-export const updateSearchResult = (config: ISearchOption, element: Element, rmCurrentCriteria = false) => {+export const updateSearchResult = (config: Config.IUILayoutTabSearchConfig, element: Element, rmCurrentCriteria = false) => {clearTimeout(toolbarSearchTimeout);toolbarSearchTimeout = window.setTimeout(() => {if (rmCurrentCriteria) {@@ -260,7 +260,7 @@ export const updateSearchResult = (config: ISearchOption, element: Element, rmCu}, Constants.TIMEOUT_INPUT);};-const initSearchEvent = (app: App, element: Element, config: ISearchOption) => {+const initSearchEvent = (app: App, element: Element, config: Config.IUILayoutTabSearchConfig) => {const searchInputElement = document.getElementById("toolbarSearch") as HTMLInputElement;searchInputElement.value = config.k || "";searchInputElement.addEventListener("compositionend", (event: InputEvent) => {@@ -298,7 +298,7 @@ const initSearchEvent = (app: App, element: Element, config: ISearchOption) => {inputElement: replaceInputElement,className: "toolbar__icon",});- const criteriaData: ISearchOption[] = [];+ const criteriaData: Config.IUILayoutTabSearchConfig[] = [];initCriteriaMenu(element.querySelector("#criteria"), criteriaData, config);const assetsElement = document.querySelector("#searchAssetsPanel");@@ -616,7 +616,7 @@ const initSearchEvent = (app: App, element: Element, config: ISearchOption) => {}, false);};-export const popSearch = (app: App, config = window.siyuan.storage[Constants.LOCAL_SEARCHDATA] as ISearchOption) => {+export const popSearch = (app: App, config = window.siyuan.storage[Constants.LOCAL_SEARCHDATA] as Config.IUILayoutTabSearchConfig) => {activeBlur();hideKeyboardToolbar();let includeChild = true;diff --git a/app/src/plugin/API.ts b/app/src/plugin/API.tsindex 1be7d9d564..20e25803aa 100644--- a/app/src/plugin/API.ts+++ b/app/src/plugin/API.ts@@ -62,7 +62,7 @@ openTab = (options: {asset?: {path: string,},- search?: ISearchOption+ search?: Config.IUILayoutTabSearchConfigcard?: {type: TCardType,id?: string, // cardType 为 all 时不传,否则传文档或笔记本 iddiff --git a/app/src/plugin/loader.ts b/app/src/plugin/loader.tsindex bbe66899fd..4b1cbc6c54 100644--- a/app/src/plugin/loader.ts+++ b/app/src/plugin/loader.ts@@ -86,9 +86,9 @@ export const loadPlugin = async (app: App, item: IPluginData) => {};-const updateDock = (dockItem: IDockTab[], index: number, plugin: Plugin, type: string) => {+const updateDock = (dockItem: Config.IUILayoutDockTab[], index: number, plugin: Plugin, type: string) => {const dockKeys = Object.keys(plugin.docks);- dockItem.forEach((tabItem: IDockTab, tabIndex: number) => {+ dockItem.forEach((tabItem: Config.IUILayoutDockTab, tabIndex: number) => {if (dockKeys.includes(tabItem.type)) {if (type === "Left") {plugin.docks[tabItem.type].config.position = index === 0 ? "LeftTop" : "LeftBottom";@@ -214,13 +214,13 @@ export const afterLoadPlugin = (plugin: Plugin) => {}/// #if !MOBILE- window.siyuan.config.uiLayout.left.data.forEach((dockItem: IDockTab[], index: number) => {+ window.siyuan.config.uiLayout.left.data.forEach((dockItem: Config.IUILayoutDockTab[], index: number) => {updateDock(dockItem, index, plugin, "Left");});- window.siyuan.config.uiLayout.right.data.forEach((dockItem: IDockTab[], index: number) => {+ window.siyuan.config.uiLayout.right.data.forEach((dockItem: Config.IUILayoutDockTab[], index: number) => {updateDock(dockItem, index, plugin, "Right");});- window.siyuan.config.uiLayout.bottom.data.forEach((dockItem: IDockTab[], index: number) => {+ window.siyuan.config.uiLayout.bottom.data.forEach((dockItem: Config.IUILayoutDockTab[], index: number) => {updateDock(dockItem, index, plugin, "Bottom");});Object.keys(plugin.docks).forEach(key => {diff --git a/app/src/search/index.ts b/app/src/search/index.tsindex 60dd59ffe0..34651f1031 100644--- a/app/src/search/index.ts+++ b/app/src/search/index.ts@@ -7,10 +7,10 @@ import {App} from "../index";export class Search extends Model {public element: HTMLElement;- public config: ISearchOption;+ public config: Config.IUILayoutTabSearchConfig;public editors: { edit: Protyle, unRefEdit: Protyle };- constructor(options: { tab: Tab, config: ISearchOption, app: App }) {+ constructor(options: { tab: Tab, config: Config.IUILayoutTabSearchConfig, app: App }) {super({app: options.app,id: options.tab.id,diff --git a/app/src/search/menu.ts b/app/src/search/menu.tsindex e3f6a407c8..ae51231b7b 100644--- a/app/src/search/menu.ts+++ b/app/src/search/menu.ts@@ -9,7 +9,7 @@ import {setStorageVal} from "../protyle/util/compatibility";import {confirmDialog} from "../dialog/confirmDialog";import {goUnRef, updateSearchResult} from "../mobile/menu/search";-export const filterMenu = (config: ISearchOption, cb: () => void) => {+export const filterMenu = (config: Config.IUILayoutTabSearchConfig, cb: () => void) => {const filterDialog = new Dialog({title: window.siyuan.languages.searchType,content: `<div class="b3-dialog__content">@@ -181,16 +181,16 @@ export const filterMenu = (config: ISearchOption, cb: () => void) => {});btnsElement[1].addEventListener("click", () => {filterDialog.element.querySelectorAll(".b3-switch").forEach((item: HTMLInputElement) => {- config.types[item.getAttribute("data-type") as TSearchFilter] = item.checked;+ config.types[item.getAttribute("data-type") as keyof (typeof config.types)] = item.checked;});cb();filterDialog.destroy();});};-export const replaceFilterMenu = (config: ISearchOption) => {+export const replaceFilterMenu = (config: Config.IUILayoutTabSearchConfig) => {let html = "";- Object.keys(Constants.SIYUAN_DEFAULT_REPLACETYPES).forEach((key) => {+ Object.keys(Constants.SIYUAN_DEFAULT_REPLACETYPES).forEach((key: keyof Config.IUILayoutTabSearchConfigReplaceTypes) => {html += `<label class="fn__flex b3-label"><span class="fn__space"></span><div class="fn__flex-1 fn__flex-center">@@ -217,13 +217,13 @@ export const replaceFilterMenu = (config: ISearchOption) => {});btnsElement[1].addEventListener("click", () => {filterDialog.element.querySelectorAll(".b3-switch").forEach((item: HTMLInputElement) => {- config.replaceTypes[item.getAttribute("data-type") as TSearchFilter] = item.checked;+ config.replaceTypes[item.getAttribute("data-type") as keyof (typeof config.replaceTypes)] = item.checked;});filterDialog.destroy();});};-export const queryMenu = (config: ISearchOption, cb: () => void) => {+export const queryMenu = (config: Config.IUILayoutTabSearchConfig, cb: () => void) => {if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&window.siyuan.menus.menu.element.getAttribute("data-name") === "searchMethod") {window.siyuan.menus.menu.remove();@@ -269,8 +269,8 @@ export const queryMenu = (config: ISearchOption, cb: () => void) => {}).element);};-const saveCriterionData = (config: ISearchOption,- criteriaData: ISearchOption[],+const saveCriterionData = (config: Config.IUILayoutTabSearchConfig,+ criteriaData: Config.IUILayoutTabSearchConfig[],element: Element,value: string,saveDialog: Dialog) => {@@ -289,8 +289,8 @@ const saveCriterionData = (config: ISearchOption,});};-export const saveCriterion = (config: ISearchOption,- criteriaData: ISearchOption[],+export const saveCriterion = (config: Config.IUILayoutTabSearchConfig,+ criteriaData: Config.IUILayoutTabSearchConfig[],element: Element) => {const saveDialog = new Dialog({title: window.siyuan.languages.saveCriterion,@@ -393,8 +393,8 @@ export const saveCriterion = (config: ISearchOption,});};-export const moreMenu = async (config: ISearchOption,- criteriaData: ISearchOption[],+export const moreMenu = async (config: Config.IUILayoutTabSearchConfig,+ criteriaData: Config.IUILayoutTabSearchConfig[],element: Element,cb: () => void,removeCriterion: () => void,@@ -605,7 +605,7 @@ export const moreMenu = async (config: ISearchOption,}).element);};-const configIsSame = (config: ISearchOption, config2: ISearchOption) => {+const configIsSame = (config: Config.IUILayoutTabSearchConfig, config2: Config.IUILayoutTabSearchConfig) => {if (config2.group === config.group && config2.hPath === config.hPath && config2.hasReplace === config.hasReplace &&config2.k === config.k && config2.method === config.method && config2.r === config.r &&config2.sort === config.sort && objEquals(config2.types, config.types) &&@@ -615,10 +615,10 @@ const configIsSame = (config: ISearchOption, config2: ISearchOption) => {return false;};-export const initCriteriaMenu = (element: HTMLElement, data: ISearchOption[], config: ISearchOption) => {+export const initCriteriaMenu = (element: HTMLElement, data: Config.IUILayoutTabSearchConfig[], config: Config.IUILayoutTabSearchConfig) => {fetchPost("/api/storage/getCriteria", {}, (response) => {let html = "";- response.data.forEach((item: ISearchOption, index: number) => {+ response.data.forEach((item: Config.IUILayoutTabSearchConfig, index: number) => {data.push(item);let isSame = false;if (configIsSame(item, config)) {diff --git a/app/src/search/util.ts b/app/src/search/util.tsindex 476373c981..1ea6bd714f 100644--- a/app/src/search/util.ts+++ b/app/src/search/util.ts@@ -120,7 +120,7 @@ export const toggleReplaceHistory = (searchElement: Element) => {});};-export const toggleSearchHistory = (searchElement: Element, config: ISearchOption, edit: Protyle) => {+export const toggleSearchHistory = (searchElement: Element, config: Config.IUILayoutTabSearchConfig, edit: Protyle) => {const list = window.siyuan.storage[Constants.LOCAL_SEARCHKEYS];if (!list.keys || list.keys.length === 0) {return;@@ -234,7 +234,7 @@ export const openGlobalSearch = (app: App, text: string, replace: boolean) => {};// closeCB 不存在为页签搜索-export const genSearch = (app: App, config: ISearchOption, element: Element, closeCB?: () => void) => {+export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, element: Element, closeCB?: () => void) => {let methodText = window.siyuan.languages.keyword;if (config.method === 1) {methodText = window.siyuan.languages.querySyntax;@@ -395,7 +395,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo</div><div class="fn__loading fn__loading--top"><img width="120px" src="/stage/loading-pure.svg"></div>`;- const criteriaData: ISearchOption[] = [];+ const criteriaData: Config.IUILayoutTabSearchConfig[] = [];initCriteriaMenu(element.querySelector("#criteria"), criteriaData, config);const searchPanelElement = element.querySelector("#searchList");const searchInputElement = element.querySelector("#searchInput") as HTMLInputElement;@@ -1072,7 +1072,7 @@ export const getQueryTip = (method: number) => {return methodTip;};-const updateConfig = (element: Element, item: ISearchOption, config: ISearchOption, edit: Protyle) => {+const updateConfig = (element: Element, item: Config.IUILayoutTabSearchConfig, config: Config.IUILayoutTabSearchConfig, edit: Protyle) => {const dialogElement = hasClosestByClassName(element, "b3-dialog--open");if (dialogElement && dialogElement.getAttribute("data-key") === Constants.DIALOG_SEARCH) {// https://github.com/siyuan-note/siyuan/issues/6828@@ -1159,7 +1159,7 @@ const renderNextSearchMark = (options: {export const getArticle = (options: {id: string,- config?: ISearchOption,+ config?: Config.IUILayoutTabSearchConfig,edit: Protylevalue?: string,}) => {@@ -1196,7 +1196,7 @@ export const getArticle = (options: {});};-export const replace = (element: Element, config: ISearchOption, edit: Protyle, isAll: boolean) => {+export const replace = (element: Element, config: Config.IUILayoutTabSearchConfig, edit: Protyle, isAll: boolean) => {if (config.method === 1 || config.method === 2) {showMessage(window.siyuan.languages._kernel[132]);return;@@ -1282,7 +1282,7 @@ export const replace = (element: Element, config: ISearchOption, edit: Protyle,});};-export const inputEvent = (element: Element, config: ISearchOption, edit: Protyle, rmCurrentCriteria = false) => {+export const inputEvent = (element: Element, config: Config.IUILayoutTabSearchConfig, edit: Protyle, rmCurrentCriteria = false) => {let inputTimeout = parseInt(element.getAttribute("data-timeout") || "0");clearTimeout(inputTimeout);inputTimeout = window.setTimeout(() => {@@ -1360,7 +1360,7 @@ export const getAttr = (block: IBlock) => {return attrHTML;};-const onSearch = (data: IBlock[], edit: Protyle, element: Element, config: ISearchOption) => {+const onSearch = (data: IBlock[], edit: Protyle, element: Element, config: Config.IUILayoutTabSearchConfig) => {let resultHTML = "";data.forEach((item, index) => {const title = getNotebookName(item.box) + getDisplayName(item.hPath, false);diff --git a/app/src/types/config.d.ts b/app/src/types/config.d.tsindex 7d6169a5c3..a50adc89c7 100644--- a/app/src/types/config.d.ts+++ b/app/src/types/config.d.ts@@ -24,7 +24,7 @@ declare namespace Config {/*** Access authorization code*/- accessAuthCode: AccessAuthCode;+ accessAuthCode: TAccessAuthCode;account: IAccount;ai: IAI;api: IAPI;@@ -79,7 +79,7 @@ declare namespace Config {sync: ISync;system: ISystem;tag: ITag;- uiLayout: IiLayout;+ uiLayout: IUiLayout;/*** Community user data (Encrypted)*/@@ -89,7 +89,7 @@ declare namespace Config {/*** Access authorization code*/- export type AccessAuthCode = "" | "*******";+ export type TAccessAuthCode = "" | "*******";/*** Account configuration@@ -124,6 +124,10 @@ declare namespace Config {* API key*/apiKey: string;+ /**+ * The maximum number of contexts passed when requesting the API+ */+ apiMaxContexts: number;/*** Maximum number of tokens (0 means no limit)*/@@ -131,16 +135,20 @@ declare namespace Config {/*** The model name called by the API*/- apiModel: TOpenAIModel;+ apiModel: TOpenAIAPIModel;/*** API Provider* OpenAI, Azure*/- apiProvider: APIProvider;+ apiProvider: TOpenAAPIProvider;/*** API request proxy address*/apiProxy: string;+ /**+ * Parameter `temperature` that controls the randomness of the generated text+ */+ apiTemperature: number;/*** API request timeout (unit: seconds)*/@@ -158,12 +166,12 @@ declare namespace Config {/*** The model name called by the API*/- export type TOpenAIModel = "gpt-4" | "gpt-4-32k" | "gpt-3.5-turbo" | "gpt-3.5-turbo-16k";+ export type TOpenAIAPIModel = "gpt-4" | "gpt-4-32k" | "gpt-3.5-turbo" | "gpt-3.5-turbo-16k";/*** API Provider*/- export type APIProvider = "OpenAI" | "Azure";+ export type TOpenAAPIProvider = "OpenAI" | "Azure";/*** SiYuan API related configuration@@ -743,7 +751,7 @@ declare namespace Config {export interface IKeymap {editor: IKeymapEditor;general: IKeymapGeneral;- plugin: { [key: string]: { [key: string]: IKey } };+ plugin: IKeymapPlugin;}/**@@ -760,7 +768,7 @@ declare namespace Config {/*** SiYuan editor general shortcut keys*/- export interface IKeymapEditorGeneral {+ export interface IKeymapEditorGeneral extends IKeys {ai: IKey;alignCenter: IKey;alignLeft: IKey;@@ -814,6 +822,13 @@ declare namespace Config {wysiwyg: IKey;}+ /**+ * SiYuan shortcut keys+ */+ export interface IKeys {+ [key: string]: IKey;+ }+/*** SiYuan shortcut key*/@@ -831,7 +846,7 @@ declare namespace Config {/*** SiYuan editor heading shortcut keys*/- export interface IKeymapEditorHeading {+ export interface IKeymapEditorHeading extends IKeys {heading1: IKey;heading2: IKey;heading3: IKey;@@ -844,7 +859,7 @@ declare namespace Config {/*** SiYuan editor insert shortcut keys*/- export interface IKeymapEditorInsert {+ export interface IKeymapEditorInsert extends IKeys {appearance: IKey;bold: IKey;check: IKey;@@ -870,7 +885,7 @@ declare namespace Config {/*** SiYuan editor list shortcut keys*/- export interface IKeymapEditorList {+ export interface IKeymapEditorList extends IKeys {checkToggle: IKey;indent: IKey;outdent: IKey;@@ -879,7 +894,7 @@ declare namespace Config {/*** SiYuan editor table shortcut keys*/- export interface IKeymapEditorTable {+ export interface IKeymapEditorTable extends IKeys {"delete-column": IKey;"delete-row": IKey;insertColumnLeft: IKey;@@ -895,7 +910,7 @@ declare namespace Config {/*** SiYuan general shortcut keys*/- export interface IKeymapGeneral {+ export interface IKeymapGeneral extends IKeys {addToDatabase: IKey;backlinks: IKey;bookmark: IKey;@@ -954,6 +969,13 @@ declare namespace Config {toggleWin: IKey;}+ /**+ * SiYuan plugin shortcut keys+ */+ export interface IKeymapPlugin {+ [key: string]: IKeys;+ }+/*** Supported language*/@@ -996,6 +1018,10 @@ declare namespace Config {* Whether to search in block aliases*/alias: boolean;+ /**+ * Whether to search in audio blocks+ */+ audioBlock: boolean;/*** Extract backlink mention keywords from block aliases*/@@ -1052,6 +1078,10 @@ declare namespace Config {* Whether to search block attributes*/ial: boolean;+ /**+ * Whether to search in iframe blocks+ */+ iFrameBlock: boolean;/*** Whether to search resource file paths*/@@ -1092,6 +1122,10 @@ declare namespace Config {* Whether to search table blocks*/table: boolean;+ /**+ * Whether to search in video blocks+ */+ videoBlock: boolean;/*** Whether to get virtual reference keywords from block aliases*/@@ -1108,6 +1142,10 @@ declare namespace Config {* Whether to get virtual reference keywords from block names*/virtualRefName: boolean;+ /**+ * Whether to search in widget blocks+ */+ widgetBlock: boolean;}/**@@ -1296,7 +1334,7 @@ declare namespace Config {* - `ios`: iOS device* - `std`: Desktop Electron environment*/- container: Container;+ container: TSystemContainer;/*** The absolute path of the `data` directory of the current workspace*/@@ -1353,7 +1391,7 @@ declare namespace Config {* - `linux`: Linux* - `windows`: Windows*/- os: OS;+ os: TSystemOS;/*** Operating system platform name*/@@ -1375,7 +1413,7 @@ declare namespace Config {* - `ios`: iOS device* - `std`: Desktop Electron environment*/- export type Container = "docker" | "android" | "ios" | "std";+ export type TSystemContainer = "docker" | "android" | "ios" | "std";/*** SiYuan Network proxy configuration@@ -1396,7 +1434,7 @@ declare namespace Config {* - `https`: HTTPS* - `socks5`: SOCKS5*/- scheme: Scheme;+ scheme: TSystemNetworkProxyScheme;}/**@@ -1406,7 +1444,7 @@ declare namespace Config {* - `https`: HTTPS* - `socks5`: SOCKS5*/- export type Scheme = "" | "http" | "https" | "socks5";+ export type TSystemNetworkProxyScheme = "" | "http" | "https" | "socks5";/*** The operating system name determined at compile time (obtained using the command `go tool@@ -1417,7 +1455,7 @@ declare namespace Config {* - `linux`: Linux* - `windows`: Windows*/- export type OS = "android" | "darwin" | "ios" | "linux" | "windows";+ export type TSystemOS = "android" | "darwin" | "ios" | "linux" | "windows";/*** SiYuan tag dock related configuration@@ -1438,7 +1476,7 @@ declare namespace Config {/*** SiYuan UI layout related configuration*/- export interface IiLayout {+ export interface IUiLayout {bottom: IUILayoutDock;/*** Whether to hide the sidebar@@ -1456,7 +1494,7 @@ declare namespace Config {/*** Dock area list*/- data: Array<IUILayoutDockPanel[]>;+ data: Array<IUILayoutDockTab[]>;/*** Whether to pin the dock*/@@ -1464,52 +1502,67 @@ declare namespace Config {}/**- * Dock panel list- *- * SiYuan dock panel data+ * SiYuan dock tab data*/- export interface IUILayoutDockPanel {+ export interface IUILayoutDockTab {/**- * Panel hotkey+ * Dock tab hotkey*/hotkey: string;/*** Hotkey description ID*/- hotkeyLangId: string;+ hotkeyLangId?: string;/**- * Panel icon ID+ * Tab icon ID*/icon: string;/**- * Whether to display the panel+ * Whether to display the tab*/show: boolean;size: IUILayoutDockPanelSize;/**- * Panel title+ * Tab title*/title: string;/**- * Panel type+ * Tab type*/type: string;}/**- * SiYuan dock panel size+ * SiYuan dock tab size*/export interface IUILayoutDockPanelSize {/**- * Panel height (unit: px)+ * Tab height (unit: px)*/height: number | null;/**- * Panel width (unit: px)+ * Tab width (unit: px)*/width: number | null;}+ /**+ * SiYuan layout item+ */+ export type TUILayoutItem = IUILayoutLayout+ | IUILayoutWnd+ | IUILayoutTab+ | IUILayoutTabEditor+ | IUILayoutTabAsset+ | IUILayoutTabCustom+ | IUILayoutTabBacklink+ | IUILayoutTabBookmark+ | IUILayoutTabFiles+ | IUILayoutTabGraph+ | IUILayoutTabOutline+ | IUILayoutTabTag+ | IUILayoutTabSearch;+/*** SiYuan panel layout*/@@ -1517,23 +1570,23 @@ declare namespace Config {/*** Internal elements*/- children: IUILayoutLayoutChild[];+ children: (IUILayoutLayout | IUILayoutWnd)[];/*** Panel content layout direction* - `tb`: Top and bottom layout* - `lr`: Left and right layout*/- direction?: Direction;+ direction?: TUILayoutDirection;/*** Object name*/- instance: LayoutInstance;+ instance: "Layout";/*** The direction in which the size can be adjusted* - `tb`: Can adjust the size up and down* - `lr`: Can adjust the size left and right*/- resize?: Direction;+ resize?: TUILayoutDirection;/*** Panel size*/@@ -1547,193 +1600,540 @@ declare namespace Config {* - `left`: Left panel* - `right`: Right panel*/- type?: Type;+ type?: TUILayoutType;}/**- * SiYuan panel layout- ** SiYuan window layout*/- export interface IUILayoutLayoutChild {+ export interface IUILayoutWnd {/*** Internal elements*/- children: ChildElement[];+ children: IUILayoutTab[];/**- * Panel content layout direction- * - `tb`: Top and bottom layout- * - `lr`: Left and right layout+ * Panel height*/- direction?: Direction;+ height?: string;/*** Object name*/- instance: IUILayoutLayoutChildInstance;+ instance: "Wnd";/*** The direction in which the size can be adjusted* - `tb`: Can adjust the size up and down* - `lr`: Can adjust the size left and right*/- resize?: Direction;+ resize?: TUILayoutDirection;/**- * Panel size+ * Panel width*/- size?: string;+ width?: string;+ }+++ export interface IUILayoutTab {/**- * Layout type- * - `normal`: Normal panel- * - `center`: Center panel- * - `top`: Top panel- * - `bottom`: Bottom panel- * - `left`: Left panel- * - `right`: Right panel+ * Whether the tab is active*/- type?: Type;+ active: boolean;/**- * Panel height+ * Tab content*/- height?: string;+ children: (IUILayoutTabAsset | IUILayoutTabBacklink | IUILayoutTabCustom | IUILayoutTabEditor)[];/**- * Panel width+ * Tab icon*/- width?: string;+ docIcon?: string;+ /**+ * Icon reference ID+ */+ icon?: string;+ /**+ * Object name+ */+ instance: "Tab";+ /**+ * Localization field key name+ */+ lang?: string;+ /**+ * Whether the tab is pinned+ */+ pin: boolean;+ /**+ * Tab title+ */+ title: string;}- export type Children = ChildElement[] | IUILayoutTabContent;-/**- * SiYuan panel layout- *- * SiYuan window layout+ * Tab content*- * SiYuan tab+ * SiYuan asset file tab*/- export interface ChildElement {- /**- * Internal elements- *- * Tab content- */- children: Children;+ export interface IUILayoutTabAsset {/**- * Panel content layout direction- * - `tb`: Top and bottom layout- * - `lr`: Left and right layout+ * Object name*/- direction?: Direction;+ instance: "Asset";/**- * Object name+ * (Asset) PDF file page number*/- instance: ChildInstance;+ page?: number;/**- * The direction in which the size can be adjusted- * - `tb`: Can adjust the size up and down- * - `lr`: Can adjust the size left and right+ * (Asset) Asset reference path*/- resize?: Direction;+ path: string;+ }+++ /**+ * SiYuan back link tab+ */+ export interface IUILayoutTabBacklink {/**- * Panel size+ * (Backlink) Block ID*/- size?: string;+ blockId: string;/**- * Layout type- * - `normal`: Normal panel- * - `center`: Center panel- * - `top`: Top panel- * - `bottom`: Bottom panel- * - `left`: Left panel- * - `right`: Right panel+ * Object name*/- type?: Type;+ instance: "Backlink";/**- * Panel height+ * (Backlink) Document block ID*/- height?: string;+ rootId: string;/**- * Panel width+ * (Backlink) Tab type+ * - `pin`: Pinned panel+ * - `local`: The panel of the current document*/- width?: string;+ type: TUILayoutTabBacklinkType;+ }++ /**+ * (Backlink) Tab type+ * - `pin`: Pinned panel+ * - `local`: The panel of the current document+ */+ export type TUILayoutTabBacklinkType = "pin" | "local";++ /**+ * SiYuan bookmark tab+ */+ export interface IUILayoutTabBookmark {/**- * Whether the tab is active+ * Object name*/- active?: boolean;+ instance: "Bookmark";+ }++ /**+ * SiYuan custom tab+ */+ export interface IUILayoutTabCustom {/**- * Tab icon+ * (Custom) Data of the custom tab*/- docIcon?: string;+ customModelData: any;/**- * Whether the tab is pinned+ * (Custom) Type of the custom tab*/- pin?: boolean;+ customModelType: string;/**- * Tab title+ * Object name*/- title?: string;+ instance: "Custom";}/**- * Tab content- ** SiYuan editor tab- *- * SiYuan asset file tab- *- * SiYuan custom tab*/- export interface IUILayoutTabContent {+ export interface IUILayoutTabEditor {/*** (Editor) Actions to be performed after the tab is loaded*/- action?: string;+ action: string;/*** (Editor) Block ID*/- blockId?: string;+ blockId: string;/*** Object name*/- instance: IUILayoutTabContentInstance;+ instance: "Editor";/*** (Editor) Editor mode* - `wysiwyg`: WYSIWYG mode* - `preview`: Export preview mode*/- mode?: Mode;+ mode: TEditorMode;/*** (Editor) Notebook ID*/- notebookId?: string;+ notebookId: string;/*** (Editor) Document block ID*/- rootId?: string;+ rootId: string;+ }++ /**+ * SiYuan filetree tab+ */+ export interface IUILayoutTabFiles {/**- * (Asset) PDF file page number+ * Object name*/- page?: number;+ instance: "Files";+ }+++ /**+ * SiYuan graph tab+ */+ export interface IUILayoutTabGraph {/**- * (Asset) Asset reference path+ * (Graph) Block ID*/- path?: string;+ blockId: string;/**- * (Custom) Data of the custom tab+ * Object name*/- customModelData?: any;+ instance: "Graph";/**- * (Custom) Type of the custom tab+ * (Graph) Document block ID+ */+ rootId: string;+ /**+ * (Graph) Tab type+ * - `pin`: Pinned graph+ * - `local`: Graph of the current editor+ * - `global`: Global graph*/- customModelType?: string;+ type: TUILayoutTabGraphType;}- export type IUILayoutTabContentInstance = "Editor" | "Asset" | "Custom";/**- * (Editor) Editor mode- * - `wysiwyg`: WYSIWYG mode- * - `preview`: Export preview mode+ * (Graph) Tab type+ * - `pin`: Pinned graph+ * - `local`: Graph of the current editor+ * - `global`: Global graph*/- export type Mode = "wysiwyg" | "preview";+ export type TUILayoutTabGraphType = "pin" | "local" | "global";++ /**+ * SiYuan outline tab+ */+ export interface IUILayoutTabOutline {+ /**+ * (Outline) Block ID+ */+ blockId: string;+ /**+ * Object name+ */+ instance: "Outline";+ /**+ * (Outline) Whether the associated editor is in preview mode+ */+ isPreview: boolean;+ /**+ * (Outline) Tab type+ * - `pin`: Pinned outline panel+ * - `local`: The outline panel of the current editor+ */+ type: TUILayoutTabOutlineType;+ }+++ /**+ * (Outline) Tab type+ * - `pin`: Pinned outline panel+ * - `local`: The outline panel of the current editor+ */+ export type TUILayoutTabOutlineType = "pin" | "local";++ /**+ * SiYuan tag tab+ */+ export interface IUILayoutTabTag {+ /**+ * Object name+ */+ instance: "Tag";+ }++ /**+ * SiYuan search tab+ */+ export interface IUILayoutTabSearch {+ config: IUILayoutTabSearchConfig;+ /**+ * Object name+ */+ instance: "Search";+ }++ /**+ * SiYuan search tab configuration+ */+ export interface IUILayoutTabSearchConfig {+ /**+ * Grouping strategy+ * - `0`: No grouping+ * - `1`: Group by document+ */+ group: number;+ hasReplace: any;+ /**+ * Readable path list+ */+ hPath: string;+ /**+ * Search in the specified paths+ */+ idPath: string[];+ /**+ * Search content+ */+ k: string;+ /**+ * Search scheme+ * - `0`: Keyword (default)+ * - `1`: Query syntax+ * - `2`: SQL+ * - `3`: Regular expression+ * @default 0+ */+ method: number;+ /**+ * Custom name of the query condition group+ */+ name?: string;+ /**+ * Current page number+ */+ page: number;+ /**+ * Replace content+ */+ r: string;+ /**+ * Whether to clear the search box after removing the currently used query condition group+ */+ removed?: boolean;+ replaceTypes: IUILayoutTabSearchConfigReplaceTypes;+ /**+ * Search result sorting scheme+ * - `0`: Block type (default)+ * - `1`: Ascending by creation time+ * - `2`: Descending by creation time+ * - `3`: Ascending by update time+ * - `4`: Descending by update time+ * - `5`: By content order (only valid when grouping by document)+ * - `6`: Ascending by relevance+ * - `7`: Descending by relevance+ * @default 0+ */+ sort: number;+ types: IUILayoutTabSearchConfigTypes;+ }++ /**+ * Replace type filtering+ */+ export interface IUILayoutTabSearchConfigReplaceTypes {+ /**+ * Replace hyperlinks+ * @default false+ */+ aHref?: boolean;+ /**+ * Replace hyperlink anchor text+ * @default true+ */+ aText?: boolean;+ /**+ * Replace hyperlink title+ * @default true+ */+ aTitle?: boolean;+ /**+ * Replace inline code+ * @default false+ */+ code?: boolean;+ /**+ * Replace code blocks+ * @default false+ */+ codeBlock?: boolean;+ /**+ * Replace document title+ * @default true+ */+ docTitle?: boolean;+ /**+ * Replace italic elements+ * @default true+ */+ em?: boolean;+ /**+ * Replace HTML blocks+ * @default false+ */+ htmlBlock?: boolean;+ /**+ * Replace image addresses+ * @default false+ */+ imgSrc?: boolean;+ /**+ * Replace image anchor text+ * @default true+ */+ imgText?: boolean;+ /**+ * Replace image titles+ * @default true+ */+ imgTitle?: boolean;+ /**+ * Replace inline formulas+ * @default false+ */+ inlineMath?: boolean;+ /**+ * Replace inline memos+ * @default true+ */+ inlineMemo?: boolean;+ /**+ * Replace kdb elements+ * @default true+ */+ kbd?: boolean;+ /**+ * Replace mark elements+ * @default true+ */+ mark?: boolean;+ /**+ * Replace formula blocks+ * @default false+ */+ mathBlock?: boolean;+ /**+ * Replace delete elements+ * @default true+ */+ s?: boolean;+ /**+ * Replace bold elements+ * @default true+ */+ strong?: boolean;+ /**+ * Replace subscript elements+ * @default true+ */+ sub?: boolean;+ /**+ * Replace superscript elements+ * @default true+ */+ sup?: boolean;+ /**+ * Replace tag elements+ * @default true+ */+ tag?: boolean;+ /**+ * Replace rich text elements+ * @default true+ */+ text?: boolean;+ /**+ * Replace underline elements+ * @default true+ */+ u?: boolean;+ }++ /**+ * Search type filtering+ */+ export interface IUILayoutTabSearchConfigTypes {+ /**+ * Search results contain blockquote blocks+ * @default false+ */+ blockquote: boolean;+ /**+ * Search results contain code blocks+ * @default false+ */+ codeBlock: boolean;+ /**+ * Search results contain database blocks+ * @default false+ */+ databaseBlock: boolean;+ /**+ * Search results contain document blocks+ * @default false+ */+ document: boolean;+ /**+ * Search results contain embed blocks+ * @default false+ */+ embedBlock: boolean;+ /**+ * Search results contain heading blocks+ * @default false+ */+ heading: boolean;+ /**+ * Search results contain html blocks+ * @default false+ */+ htmlBlock: boolean;+ /**+ * Search results contain list blocks+ * @default false+ */+ list: boolean;+ /**+ * Search results contain list item blocks+ * @default false+ */+ listItem: boolean;+ /**+ * Search results contain math blocks+ * @default false+ */+ mathBlock: boolean;+ /**+ * Search results contain paragraph blocks+ * @default false+ */+ paragraph: boolean;+ /**+ * Search results contain super blocks+ * @default false+ */+ superBlock: boolean;+ /**+ * Search results contain table blocks+ * @default false+ */+ table: boolean;+ }+/*** Panel content layout direction@@ -1744,9 +2144,7 @@ declare namespace Config {* - `tb`: Can adjust the size up and down* - `lr`: Can adjust the size left and right*/- export type Direction = "tb" | "lr";-- export type ChildInstance = "Layout" | "Wnd" | "Tab";+ export type TUILayoutDirection = "tb" | "lr";/*** Layout type@@ -1757,10 +2155,6 @@ declare namespace Config {* - `left`: Left panel* - `right`: Right panel*/- export type Type = "normal" | "center" | "top" | "bottom" | "left" | "right";-- export type IUILayoutLayoutChildInstance = "Layout" | "Wnd";-- export type LayoutInstance = "Layout";+ export type TUILayoutType = "normal" | "center" | "top" | "bottom" | "left" | "right";}diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.tsindex 83eef2c131..fe0d781be4 100644--- a/app/src/types/index.d.ts+++ b/app/src/types/index.d.ts@@ -1,7 +1,3 @@-type TLayout = "normal" | "bottom" | "left" | "right" | "center"-type TSearchFilter = "mathBlock" | "table" | "blockquote" | "superBlock" | "paragraph" | "document" | "heading"- | "list" | "listItem" | "codeBlock" | "htmlBlock"-type TDirection = "lr" | "tb"type TPluginDockPosition = "LeftTop" | "LeftBottom" | "RightTop" | "RightBottom" | "BottomLeft" | "BottomRight"type TDockPosition = "Left" | "Right" | "Bottom"type TWS = "main" | "filetree" | "protyle"@@ -507,23 +503,10 @@ interface ILayoutJSON extends ILayoutOptions {isPreview?: booleancustomModelData?: anycustomModelType?: string- config?: ISearchOption+ config?: Config.IUILayoutTabSearchConfigchildren?: ILayoutJSON[] | ILayoutJSON}-interface IDockTab {- type: string;- size: {- width: number,- height: number- }- show: boolean- icon: string- title: string- hotkey?: string- hotkeyLangId?: string // 常量中无法存变量-}-interface ICommand {langKey: string, // 用于区分不同快捷键的 key, 同时作为 i18n 的字段名langText?: string, // 显示的文本, 指定后不再使用 langKey 对应的 i18n 文本@@ -564,7 +547,7 @@ interface IExportOptions {interface IOpenFileOptions {app: import("../index").App,- searchData?: ISearchOption, // 搜索必填+ searchData?: Config.IUILayoutTabSearchConfig, // 搜索必填// card 和自定义页签 必填custom?: {title: string,@@ -592,10 +575,10 @@ interface IOpenFileOptions {}interface ILayoutOptions {- direction?: TDirection;+ direction?: Config.TUILayoutDirectionsize?: string- resize?: TDirection- type?: TLayout+ resize?: Config.TUILayoutDirection+ type?: Config.TUILayoutTypeelement?: HTMLElement}