mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-04 07:48:49 +01:00
This commit is contained in:
parent
62d871373b
commit
0b7caf028c
3 changed files with 11 additions and 3 deletions
|
|
@ -5,6 +5,7 @@ import {Constants} from "../constants";
|
|||
import {showMessage} from "../dialog/message";
|
||||
import {fetchPost} from "../util/fetch";
|
||||
import {escapeHtml} from "../util/escape";
|
||||
import {setStorageVal} from "../protyle/util/compatibility";
|
||||
|
||||
export const filterMenu = (config: ISearchOption, cb: () => void) => {
|
||||
const filterDialog = new Dialog({
|
||||
|
|
@ -335,9 +336,12 @@ export const moreMenu = async (config: ISearchOption,
|
|||
config.k = (element.querySelector("#searchInput") as HTMLInputElement).value;
|
||||
config.r = (element.querySelector("#replaceInput") as HTMLInputElement).value;
|
||||
}
|
||||
config.removed = false;
|
||||
const criterion = config;
|
||||
criterion.name = value;
|
||||
criteriaData.push(Object.assign({}, criterion));
|
||||
window.siyuan.storage[Constants.LOCAL_SEARCHDATA] = Object.assign({}, config);
|
||||
setStorageVal(Constants.LOCAL_SEARCHDATA, window.siyuan.storage[Constants.LOCAL_SEARCHDATA]);
|
||||
fetchPost("/api/storage/setCriterion", {criterion}, () => {
|
||||
saveDialog.destroy();
|
||||
const criteriaElement = element.querySelector("#criteria");
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ export const openSearch = async (hotkey: string, key?: string, notebookId?: stri
|
|||
group: localData.group,
|
||||
sort: localData.sort,
|
||||
types: localData.types,
|
||||
page: localData.page
|
||||
page: key ? 1 : localData.page
|
||||
}, dialog.element.querySelector(".b3-dialog__container").lastElementChild, () => {
|
||||
dialog.destroy();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ export const openGlobalSearch = (text: string, replace: boolean) => {
|
|||
sort: localData.sort,
|
||||
types: localData.types,
|
||||
removed: localData.removed,
|
||||
page: localData.page
|
||||
page: 1
|
||||
}
|
||||
});
|
||||
tab.addModel(asset);
|
||||
|
|
@ -1073,13 +1073,17 @@ const inputEvent = (element: Element, config: ISearchOption, inputTimeout: numbe
|
|||
orderBy: config.sort,
|
||||
page: config.page || 1,
|
||||
}, (response) => {
|
||||
if (!config.page) {
|
||||
config.page = 1
|
||||
}
|
||||
if (config.page < response.data.pageCount) {
|
||||
nextElement.removeAttribute("disabled");
|
||||
} else {
|
||||
nextElement.setAttribute("disabled", "disabled");
|
||||
}
|
||||
onSearch(response.data.blocks, edit, element);
|
||||
element.querySelector("#searchResult").innerHTML = window.siyuan.languages.findInDoc.replace("${x}", response.data.matchedRootCount).replace("${y}", response.data.matchedBlockCount);
|
||||
element.querySelector("#searchResult").innerHTML = `${config.page}/${response.data.pageCount || 1}<span class="fn__space"></span>` +
|
||||
window.siyuan.languages.findInDoc.replace("${x}", response.data.matchedRootCount).replace("${y}", response.data.matchedBlockCount);
|
||||
loadingElement.classList.add("fn__none");
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue