This commit is contained in:
Vanessa 2023-04-03 12:16:01 +08:00 committed by Liang Ding
parent 092d2529f1
commit fb6248c3e5
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 27 additions and 9 deletions

View file

@ -180,7 +180,7 @@
border: solid 1px var(--b3-theme-surface-lighter);
border-radius: 3px;
box-shadow: inset 0 -1px 0 var(--b3-theme-surface-lighter);
margin: 0 4px 0 16px;
margin: 2px 4px 0 16px;
}
}
}

View file

@ -1285,18 +1285,34 @@ const replace = (element: Element, config: ISearchOption, edit: Protyle, isAll:
reloadProtyle(item.editor.protyle);
}
});
if (!currentList.nextElementSibling && searchPanelElement.children[0]) {
searchPanelElement.children[0].classList.add("b3-list-item--focus");
} else {
if (currentList.nextElementSibling) {
currentList.nextElementSibling.classList.add("b3-list-item--focus");
} else if (currentList.previousElementSibling) {
currentList.previousElementSibling.classList.add("b3-list-item--focus");
}
currentList.remove();
if (searchPanelElement.childElementCount === 0) {
searchPanelElement.innerHTML = `<div class="b3-list--empty">${window.siyuan.languages.emptyContent}</div>`;
edit.protyle.element.classList.add("fn__none");
return;
if (config.group === 1) {
if (currentList.nextElementSibling || currentList.previousElementSibling) {
currentList.remove();
} else {
const nextDocElement = currentList.parentElement.nextElementSibling || currentList.parentElement.previousElementSibling.previousElementSibling?.previousElementSibling
if (nextDocElement) {
nextDocElement.nextElementSibling.firstElementChild.classList.add("b3-list-item--focus");
nextDocElement.nextElementSibling.classList.remove("fn__none");
nextDocElement.firstElementChild.firstElementChild.classList.add("b3-list-item__arrow--open");
}
currentList.parentElement.previousElementSibling.remove();
currentList.parentElement.remove();
}
} else {
currentList.remove();
}
currentList = searchPanelElement.querySelector(".b3-list-item--focus");
if (!currentList) {
searchPanelElement.innerHTML = `<div class="b3-list--empty">${window.siyuan.languages.emptyContent}</div>`;
edit.protyle.element.classList.add("fn__none");
element.querySelector(".search__drag").classList.add("fn__none");
return;
}
if (searchPanelElement.scrollTop < currentList.offsetTop - searchPanelElement.clientHeight + 30 ||
searchPanelElement.scrollTop > currentList.offsetTop) {
searchPanelElement.scrollTop = currentList.offsetTop - searchPanelElement.clientHeight + 30;
@ -1376,6 +1392,7 @@ ${unicode2Emoji(item.ial.icon, false, "b3-list-item__graphic", true)}
if (data[0]) {
edit.protyle.element.classList.remove("fn__none");
element.querySelector(".search__drag").classList.remove("fn__none");
const contentElement = document.createElement("div");
if (data[0].children) {
contentElement.innerHTML = data[0].children[0].content;
@ -1394,6 +1411,7 @@ ${unicode2Emoji(item.ial.icon, false, "b3-list-item__graphic", true)}
}
} else {
edit.protyle.element.classList.add("fn__none");
element.querySelector(".search__drag").classList.add("fn__none");
}
element.querySelector("#searchList").innerHTML = resultHTML || `<div class="b3-list--empty">${window.siyuan.languages.emptyContent}</div>`;
};