Skip to content

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

:bug: Preserve relation text and respect column wrapping in relation picker

Vanessa7a5b12b30653
diff --git a/app/src/assets/scss/business/_av.scss b/app/src/assets/scss/business/_av.scss
index 101cc8dc31..a65cf5d002 100644
--- a/app/src/assets/scss/business/_av.scss
+++ b/app/src/assets/scss/business/_av.scss
@@ -2772,6 +2772,28 @@ img.av__cellassetimg {
.av__relation-table-cell {
border-right: 1px solid var(--b3-border-color);
+ &[data-dtype="relation"] {
+ gap: 4px 12px;
+
+ > .av__cell--relation {
+ flex-shrink: 0;
+ margin-right: 0;
+ }
+
+ .av__celltext {
+ min-width: 0;
+ }
+
+ &[data-wrap="true"] {
+ flex-wrap: wrap;
+
+ .av__celltext {
+ overflow-wrap: anywhere;
+ white-space: normal;
+ }
+ }
+ }
+
&:last-child {
border-right: 0;
}
diff --git a/app/src/protyle/render/av/relation.ts b/app/src/protyle/render/av/relation.ts
index 4178ed42cc..9d64f758b0 100644
--- a/app/src/protyle/render/av/relation.ts
+++ b/app/src/protyle/render/av/relation.ts
@@ -479,7 +479,7 @@ style="${primaryCell.bgColor ? `background-color:${primaryCell.bgColor};` : ""}$
data-position="north" aria-label="${window.siyuan.languages.openBy}"><svg><use xlink:href="#iconOpen"></use></svg></button>` : ""}
</span>`;
} else {
- html += `<div data-relation-column="${escapeAttr(column.id)}" class="av__relation-table-cell"
+ html += `<div data-relation-column="${escapeAttr(column.id)}" data-dtype="${column.type}" data-wrap="${column.wrap === true}" class="av__relation-table-cell"
style="${cell?.bgColor ? `background-color:${cell.bgColor};` : ""}${cell?.color ? `color:${cell.color};` : ""}">${cell?.value ?
renderCell(cell.value, 0, true, "table", column.options, column.dateFormat, column.renderTemplate, false) : ""}</div>`;
}