diff --git a/app/src/protyle/render/av/asset.ts b/app/src/protyle/render/av/asset.ts index d7af78a76..9b785523d 100644 --- a/app/src/protyle/render/av/asset.ts +++ b/app/src/protyle/render/av/asset.ts @@ -226,8 +226,7 @@ export const editAssetItem = (protyle: IProtyle, data: IAV, cellElements: HTMLEl menu.addItem({ iconHTML: "", type: "readonly", - label: `
-`, + label: `${window.siyuan.languages.title}`, }); } else { menu.addItem({ @@ -296,10 +295,10 @@ export const addAssetLink = (protyle: IProtyle, data: IAV, cellElements: HTMLEle menu.addItem({ iconHTML: "", type: "readonly", - label: ` + label: `${window.siyuan.languages.link} - +${window.siyuan.languages.title} `, }); const rect = target.getBoundingClientRect(); diff --git a/app/src/protyle/render/av/filter.ts b/app/src/protyle/render/av/filter.ts index 9b7869072..a777cbe5d 100644 --- a/app/src/protyle/render/av/filter.ts +++ b/app/src/protyle/render/av/filter.ts @@ -270,6 +270,7 @@ export const setFilter = async (options: { } menu.addItem({ iconHTML: "", + type: "readonly", label: `` }); if (filterType === "select" || filterType === "mSelect") { @@ -308,21 +309,25 @@ export const setFilter = async (options: { } menu.addItem({ iconHTML: "", + type: "readonly", label: `` }); } else if (filterType === "number") { menu.addItem({ iconHTML: "", + type: "readonly", label: `` }); } else if (["date", "updated", "created"].includes(filterType)) { const dateValue = options.filter.value ? options.filter.value[filterType as "date"] : null; menu.addItem({ iconHTML: "", + type: "readonly", label: `` }); menu.addItem({ iconHTML: "", + type: "readonly", label: `` }); } diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.ts index 80fa22db0..e85e1882c 100644 --- a/app/src/protyle/render/av/openMenuPanel.ts +++ b/app/src/protyle/render/av/openMenuPanel.ts @@ -117,7 +117,12 @@ export const openMenuPanel = (options: { setPosition(menuElement, cellRect.left, cellRect.bottom, cellRect.height); }, Constants.TIMEOUT_LOAD); // 等待加载 } else if (options.type === "relation") { - bindRelationEvent({menuElement, cellElements: options.cellElements}); + bindRelationEvent({ + menuElement, + cellElements: options.cellElements, + protyle: options.protyle, + blockElement: options.blockElement + }); } else if (options.type === "rollup") { bindRollupEvent({protyle: options.protyle, data, menuElement}); } diff --git a/app/src/protyle/render/av/relation.ts b/app/src/protyle/render/av/relation.ts index 91ba31859..0e92557f0 100644 --- a/app/src/protyle/render/av/relation.ts +++ b/app/src/protyle/render/av/relation.ts @@ -214,11 +214,24 @@ const genSelectItemHTML = (type: "selected" | "empty" | "unselect", id?: string, } }; +const filterItem = (listElement: Element, key: string) => { + Array.from(listElement.children).forEach((item: HTMLElement) => { + if (item.dataset.id) { + if (item.textContent.includes(key)) { + item.classList.remove("fn__none"); + } else { + item.classList.add("fn__none") + } + } + }) +} export const bindRelationEvent = (options: { menuElement: HTMLElement, + protyle: IProtyle, + blockElement: Element, cellElements: HTMLElement[] }) => { - const hasIds = options.menuElement.textContent.split(","); + const hasIds = options.menuElement.firstElementChild.getAttribute("data-cell-ids").split(","); fetchPost("/api/av/renderAttributeView", { id: options.menuElement.firstElementChild.getAttribute("data-av-id"), }, response => { @@ -247,11 +260,51 @@ export const bindRelationEvent = (options: { html += genSelectItemHTML("unselect", item.id, item.cells[cellIndex].value.isDetached, item.cells[cellIndex].value.block.content || "Untitled"); } }); - options.menuElement.innerHTML = ` `; + options.menuElement.innerHTML = `