diff --git a/app/src/protyle/render/av/relation.ts b/app/src/protyle/render/av/relation.ts
index 12ebb2768..ac78dda16 100644
--- a/app/src/protyle/render/av/relation.ts
+++ b/app/src/protyle/render/av/relation.ts
@@ -240,12 +240,8 @@ const filterItem = (menuElement: Element, cellElement: HTMLElement, keyword: str
let html = "";
let selectHTML = "";
const hasIds: string[] = [];
- let selectHasShowItem = false;
cellElement.querySelectorAll("span").forEach((item) => {
hasIds.push(item.dataset.id);
- if (item.textContent.indexOf(keyword) > -1) {
- selectHasShowItem = true;
- }
selectHTML += ``;
});
cells.forEach((item) => {
@@ -255,7 +251,8 @@ const filterItem = (menuElement: Element, cellElement: HTMLElement, keyword: str
});
menuElement.querySelector(".b3-menu__items").innerHTML = `${selectHTML}
-${html || genSelectItemHTML("empty", selectHasShowItem ? "" : keyword, undefined, menuElement.querySelector(".popover__block").outerHTML)}`;
+${html}
+${keyword ? genSelectItemHTML("empty", keyword, undefined, menuElement.querySelector(".popover__block").outerHTML) : (html ? "" : genSelectItemHTML("empty"))}`;
menuElement.querySelector(".b3-menu__items .b3-menu__item:not(.fn__none)").classList.add("b3-menu__item--current");
});
};
@@ -381,8 +378,9 @@ export const setRelationCell = (protyle: IProtyle, nodeElement: HTMLElement, tar
if (target.classList.contains("b3-menu__item")) {
const targetId = target.getAttribute("data-id");
const separatorElement = menuElement.querySelector(".b3-menu__separator");
+ const searchValue = menuElement.querySelector('input').value;
if (target.getAttribute("draggable")) {
- if (!separatorElement.nextElementSibling.getAttribute("data-id")) {
+ if (!separatorElement.nextElementSibling.getAttribute("data-id") && !searchValue) {
separatorElement.nextElementSibling.remove();
}
const removeIndex = newValue.blockIDs.indexOf(targetId);
@@ -411,6 +409,7 @@ export const setRelationCell = (protyle: IProtyle, nodeElement: HTMLElement, tar
const rowId = Lute.NewNodeID();
transaction(protyle, [{
action: "insertAttrViewBlock",
+ ignoreFillFilter: true,
avID: menuElement.firstElementChild.getAttribute("data-av-id"),
srcs: [{
id: rowId,
@@ -432,11 +431,7 @@ export const setRelationCell = (protyle: IProtyle, nodeElement: HTMLElement, tar
},
isDetached: true
});
- separatorElement.before(target);
- target.outerHTML = ``;
- if (!separatorElement.nextElementSibling) {
- separatorElement.insertAdjacentHTML("afterend", genSelectItemHTML("empty"));
- }
+ separatorElement.insertAdjacentHTML("beforebegin", ``);
}
menuElement.querySelector(".b3-menu__item--current")?.classList.remove("b3-menu__item--current");
menuElement.querySelector(".b3-menu__items .b3-menu__item:not(.fn__none)").classList.add("b3-menu__item--current");