Skip to content

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

:bug: https://github.com/siyuan-note/siyuan/issues/17492

Vanessab7f1d12b8fc3
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts
index 083b0b4bde..c1e1fbc868 100644
--- a/app/src/protyle/render/av/cell.ts
+++ b/app/src/protyle/render/av/cell.ts
@@ -786,13 +786,6 @@ export const updateCellsValue = async (protyle: IProtyle, nodeElement: HTMLEleme
name = getAssetName(value) + pathPosix().extname(value);
}
// https://github.com/siyuan-note/siyuan/issues/12308
- if (link) {
- htmlValue.push({
- type: "file",
- content: link,
- name
- });
- }
if (html) {
const tempElement = document.createElement("template");
tempElement.innerHTML = html;
@@ -811,14 +804,28 @@ export const updateCellsValue = async (protyle: IProtyle, nodeElement: HTMLEleme
});
}
});
- if (htmlValue.length === 0 && value) {
+ }
+ if (link) {
+ const hasExited = htmlValue.find(valueItem => {
+ if (valueItem.content === link) {
+ return true;
+ }
+ });
+ if (!hasExited) {
htmlValue.push({
type: "file",
- content: "",
- name: value
+ content: link,
+ name
});
}
}
+ if (htmlValue.length === 0 && value) {
+ htmlValue.push({
+ type: "file",
+ content: "",
+ name: value
+ });
+ }
newValue = oldValue.mAsset.concat(htmlValue);
}
} else if (type === "mSelect" || type === "select") {