mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-29 19:56:10 +01:00
This commit is contained in:
parent
2d99bf6a8f
commit
580a502714
2 changed files with 42 additions and 17 deletions
|
|
@ -82,9 +82,15 @@ export const commandPanel = (app: App) => {
|
|||
|
||||
const filterList = (inputElement: HTMLInputElement, listElement: Element) => {
|
||||
const inputValue = inputElement.value.toLowerCase();
|
||||
listElement.querySelector(".b3-list-item--focus")?.classList.remove("b3-list-item--focus");
|
||||
let hasFocus = false;
|
||||
Array.from(listElement.children).forEach((element: HTMLElement) => {
|
||||
const elementValue = element.querySelector(".b3-list-item__text").textContent.toLowerCase();
|
||||
if (inputValue.indexOf(elementValue) > -1 || elementValue.indexOf(inputValue) > -1) {
|
||||
if (!hasFocus) {
|
||||
element.classList.add("b3-list-item--focus");
|
||||
}
|
||||
hasFocus = true
|
||||
element.classList.remove("fn__none");
|
||||
} else {
|
||||
element.classList.add("fn__none");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue