Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/10523

Vanessa6a6e4cd182f9
diff --git a/app/src/protyle/render/av/relation.ts b/app/src/protyle/render/av/relation.ts
index e46faca9bf..489985f625 100644
--- a/app/src/protyle/render/av/relation.ts
+++ b/app/src/protyle/render/av/relation.ts
@@ -4,7 +4,7 @@ import {upDownHint} from "../../../util/upDownHint";
import {fetchPost} from "../../../util/fetch";
import {escapeGreat, escapeHtml} from "../../../util/escape";
import {transaction} from "../../wysiwyg/transaction";
-import {updateCellsValue} from "./cell";
+import {genCellValueByElement, updateCellsValue} from "./cell";
import {updateAttrViewCellAnimation} from "./action";
import {focusBlock} from "../../util/selection";
import {setPosition} from "../../../util/setPosition";
@@ -237,7 +237,7 @@ const filterItem = (menuElement: Element, keyword: string) => {
id: menuElement.firstElementChild.getAttribute("data-av-id"),
keyword,
}, response => {
- const cells = response.data.rows.values as IAVCellValue[];
+ const cells = response.data.rows.values as IAVCellValue[] || [];
let html = "";
let selectHTML = "";
hasIds.forEach(hasId => {
@@ -272,7 +272,7 @@ export const bindRelationEvent = (options: {
id: options.menuElement.firstElementChild.getAttribute("data-av-id"),
keyword: "",
}, response => {
- const cells = response.data.rows.values as IAVCellValue[];
+ const cells = response.data.rows.values as IAVCellValue[] || [];
let html = "";
let selectHTML = "";
hasIds.forEach(hasId => {
@@ -363,20 +363,7 @@ export const setRelationCell = (protyle: IProtyle, nodeElement: HTMLElement, tar
if (!menuElement) {
return;
}
- const newValue: {
- blockIDs: string[]
- contents?: string[]
- } = {
- blockIDs: [],
- contents: []
- };
- Array.from(menuElement.children).forEach((item) => {
- const id = item.getAttribute("data-id");
- if (item.getAttribute("draggable") && id) {
- newValue.blockIDs.push(id);
- newValue.contents.push(item.textContent.trim());
- }
- });
+ const newValue = genCellValueByElement("relation", cellElements[0]).relation;
if (target.classList.contains("b3-menu__item")) {
const targetId = target.getAttribute("data-id");
const separatorElement = menuElement.querySelector(".b3-menu__separator");