Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: fix https://github.com/siyuan-note/siyuan/issues/10052

Vanessad9bfc45592f7
diff --git a/app/src/protyle/render/av/select.ts b/app/src/protyle/render/av/select.ts
index a5ccef810f..fc85288084 100644
--- a/app/src/protyle/render/av/select.ts
+++ b/app/src/protyle/render/av/select.ts
@@ -427,7 +427,18 @@ export const addColOptionOrCell = (protyle: IProtyle, data: IAV, cellElements: H
const nodeElement = hasClosestBlock(cellElements[0]);
if (!nodeElement) {
cellElements.forEach((item, index) => {
- cellElements[index] = blockElement.querySelector(`.av__cell[data-id="${item.dataset.id}"]`) as HTMLElement;
+ const rowElement = hasClosestByClassName(item, "av__row");
+ if (rowElement) {
+ let cellIndex: number;
+ rowElement.querySelectorAll(".av__cell").forEach((cellElement: HTMLElement, ghostIndex) => {
+ if (cellElement.dataset.id === item.dataset.id) {
+ cellIndex = ghostIndex
+ }
+ });
+ if (typeof cellIndex === "number") {
+ cellElements[index] = blockElement.querySelectorAll(`.av__row[data-id="${rowElement.dataset.id}"] .av__cell`)[cellIndex] as HTMLElement;
+ }
+ }
});
}
const colId = cellElements[0].dataset.colId;
@@ -545,25 +556,9 @@ export const getSelectHTML = (data: IAVTable, cellElements: HTMLElement[]) => {
}
});
- let allUniqueOptions: IAVCellSelectValue[] = [];
- data.rows.find(row => {
- const rowElement = hasClosestByClassName(cellElements[0], "av__row");
- if (rowElement && rowElement.dataset.id === row.id) {
- row.cells.find(cell => {
- if (cell.id === cellElements[0].dataset.id) {
- if (cell.value && cell.value.mSelect) {
- allUniqueOptions = cell.value.mSelect;
- }
- return true;
- }
- });
- return true;
- }
- });
-
let selectedHTML = "";
- allUniqueOptions.forEach((unique) => {
- selectedHTML += `<div class="b3-chip b3-chip--middle" data-content="${escapeAttr(unique.content)}" style="background-color:var(--b3-font-background${unique.color});color:var(--b3-font-color${unique.color})">${unique.content}<svg class="b3-chip__close" data-type="removeCellOption"><use xlink:href="#iconCloseRound"></use></svg></div>`;
+ genCellValueByElement(colData.type, cellElements[0]).mSelect?.forEach((item) => {
+ selectedHTML += `<div class="b3-chip b3-chip--middle" data-content="${escapeAttr(item.content)}" style="background-color:var(--b3-font-background${item.color});color:var(--b3-font-color${item.color})">${item.content}<svg class="b3-chip__close" data-type="removeCellOption"><use xlink:href="#iconCloseRound"></use></svg></div>`;
});
return `<div class="b3-menu__items">