mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
This commit is contained in:
parent
40c56d1400
commit
5a22155e9f
1 changed files with 19 additions and 3 deletions
|
|
@ -383,7 +383,15 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: ()
|
|||
if (event.key === "ArrowDown") {
|
||||
currentList.classList.remove("b3-list-item--focus");
|
||||
if (!currentList.nextElementSibling) {
|
||||
searchPanelElement.children[0].classList.add("b3-list-item--focus");
|
||||
if (config.group === 1) {
|
||||
if (currentList.parentElement.nextElementSibling) {
|
||||
currentList.parentElement.nextElementSibling.nextElementSibling.firstElementChild.classList.add("b3-list-item--focus");
|
||||
} else {
|
||||
searchPanelElement.children[1].firstElementChild.classList.add("b3-list-item--focus");
|
||||
}
|
||||
} else {
|
||||
searchPanelElement.firstElementChild.classList.add("b3-list-item--focus");
|
||||
}
|
||||
} else {
|
||||
currentList.nextElementSibling.classList.add("b3-list-item--focus");
|
||||
}
|
||||
|
|
@ -401,8 +409,15 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: ()
|
|||
} else if (event.key === "ArrowUp") {
|
||||
currentList.classList.remove("b3-list-item--focus");
|
||||
if (!currentList.previousElementSibling) {
|
||||
const length = searchPanelElement.children.length;
|
||||
searchPanelElement.children[length - 1].classList.add("b3-list-item--focus");
|
||||
if (config.group === 1) {
|
||||
if (currentList.parentElement.previousElementSibling.previousElementSibling) {
|
||||
currentList.parentElement.previousElementSibling.previousElementSibling.lastElementChild.classList.add("b3-list-item--focus");
|
||||
} else {
|
||||
searchPanelElement.lastElementChild.lastElementChild.classList.add("b3-list-item--focus");
|
||||
}
|
||||
} else {
|
||||
searchPanelElement.lastElementChild.classList.add("b3-list-item--focus");
|
||||
}
|
||||
} else {
|
||||
currentList.previousElementSibling.classList.add("b3-list-item--focus");
|
||||
}
|
||||
|
|
@ -589,6 +604,7 @@ const inputEvent = (element: Element, config: ISearchOption, inputTimeout: numbe
|
|||
inputTimeout = window.setTimeout(() => {
|
||||
loadingElement.classList.remove("fn__none");
|
||||
const inputValue = searchInputElement.value;
|
||||
element.querySelector("#searchList").scrollTo(0, 0);
|
||||
if (inputValue === "") {
|
||||
fetchPost("/api/block/getRecentUpdatedBlocks", {}, (response) => {
|
||||
onSearch(response.data, edit, element);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue