Vanessa 2025-07-16 11:35:39 +08:00
parent eea07195c6
commit add48a9983
2 changed files with 7 additions and 3 deletions

View file

@ -1234,7 +1234,7 @@ export const inputEvent = (element: Element, config: Config.IUILayoutTabSearchCo
const loadingElement = element.querySelector(".fn__loading--top");
loadingElement.classList.remove("fn__none");
const searchInputElement = element.querySelector("#searchInput") as HTMLInputElement;
const inputValue = searchInputElement.value;
config.query = searchInputElement.value;
element.querySelector("#searchList").scrollTo(0, 0);
const previousElement = element.querySelector('[data-type="previous"]');
const nextElement = element.querySelector('[data-type="next"]');
@ -1246,7 +1246,7 @@ export const inputEvent = (element: Element, config: Config.IUILayoutTabSearchCo
});
});
const searchResultElement = element.querySelector("#searchResult");
if (inputValue === "" && (!config.idPath || config.idPath.length === 0)) {
if (config.query === "" && (!config.idPath || config.idPath.length === 0)) {
fetchPost("/api/block/getRecentUpdatedBlocks", {}, (response) => {
if (window.siyuan.reqIds["/api/block/getRecentUpdatedBlocks"] && window.siyuan.reqIds["/api/search/fullTextSearchBlock"] &&
window.siyuan.reqIds["/api/block/getRecentUpdatedBlocks"] < window.siyuan.reqIds["/api/search/fullTextSearchBlock"]) {
@ -1265,7 +1265,7 @@ export const inputEvent = (element: Element, config: Config.IUILayoutTabSearchCo
previousElement.setAttribute("disabled", "disabled");
}
fetchPost("/api/search/fullTextSearchBlock", {
query: inputValue,
query: config.query,
method: config.method,
types: config.types,
paths: config.idPath || [],

View file

@ -2058,6 +2058,10 @@ declare namespace Config {
* SiYuan search tab configuration
*/
export interface IUILayoutTabSearchConfig {
/**
*
*/
query?: string;
/**
* Grouping strategy
* - `0`: No grouping