This commit is contained in:
parent
c5d9b83224
commit
8af49fcc16
2 changed files with 7 additions and 7 deletions
|
@ -930,7 +930,7 @@ export const openMenuPanel = (options: {
|
|||
event.stopPropagation();
|
||||
break;
|
||||
} else if (type === "goSearchAV") {
|
||||
openSearchAV(avID, target);
|
||||
openSearchAV(avID, target, undefined, false);
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
|
|
|
@ -9,8 +9,8 @@ import {updateAttrViewCellAnimation} from "./action";
|
|||
import {focusBlock} from "../../util/selection";
|
||||
import {setPosition} from "../../../util/setPosition";
|
||||
|
||||
const genSearchList = (element: Element, keyword: string, avId: string, cb?: () => void) => {
|
||||
fetchPost("/api/av/searchAttributeView", {keyword, excludes: [avId]}, (response) => {
|
||||
const genSearchList = (element: Element, keyword: string, avId: string, excludes = true, cb?: () => void) => {
|
||||
fetchPost("/api/av/searchAttributeView", {keyword, excludes: excludes ? [avId] : undefined}, (response) => {
|
||||
let html = "";
|
||||
response.data.results.forEach((item: {
|
||||
avID: string
|
||||
|
@ -45,7 +45,7 @@ const setDatabase = (avId: string, element: HTMLElement, item: HTMLElement) => {
|
|||
}
|
||||
};
|
||||
|
||||
export const openSearchAV = (avId: string, target: HTMLElement, cb?: (element: HTMLElement) => void) => {
|
||||
export const openSearchAV = (avId: string, target: HTMLElement, cb?: (element: HTMLElement) => void, excludes = true) => {
|
||||
window.siyuan.menus.menu.remove();
|
||||
const menu = new Menu();
|
||||
menu.addItem({
|
||||
|
@ -86,10 +86,10 @@ export const openSearchAV = (avId: string, target: HTMLElement, cb?: (element: H
|
|||
if (event.isComposing) {
|
||||
return;
|
||||
}
|
||||
genSearchList(listElement, inputElement.value, avId);
|
||||
genSearchList(listElement, inputElement.value, avId, excludes);
|
||||
});
|
||||
inputElement.addEventListener("compositionend", () => {
|
||||
genSearchList(listElement, inputElement.value, avId);
|
||||
genSearchList(listElement, inputElement.value, avId, excludes);
|
||||
});
|
||||
element.lastElementChild.addEventListener("click", (event) => {
|
||||
const listItemElement = hasClosestByClassName(event.target as HTMLElement, "b3-list-item");
|
||||
|
@ -103,7 +103,7 @@ export const openSearchAV = (avId: string, target: HTMLElement, cb?: (element: H
|
|||
window.siyuan.menus.menu.remove();
|
||||
}
|
||||
});
|
||||
genSearchList(listElement, "", avId, () => {
|
||||
genSearchList(listElement, "", avId, excludes, () => {
|
||||
const rect = target.getBoundingClientRect();
|
||||
menu.open({
|
||||
x: rect.left,
|
||||
|
|
Loading…
Add table
Reference in a new issue