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/11487

Vanessa1860b641f0de
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts
index 09646390cf..0596813a18 100644
--- a/app/src/protyle/render/av/cell.ts
+++ b/app/src/protyle/render/av/cell.ts
@@ -574,6 +574,7 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va
} else if (typeof value !== "undefined") { // 不传入为删除,传入字符串不进行处理
let link = protyle.lute.GetLinkDest(value);
let name = "";
+ let imgSrc = "";
if (html) {
const tempElement = document.createElement("template");
tempElement.innerHTML = html;
@@ -581,17 +582,31 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va
if (aElement) {
link = aElement.getAttribute("data-href");
name = aElement.textContent;
+ } else {
+ const imgElement = tempElement.content.querySelector('.img img');
+ if (imgElement) {
+ imgSrc = imgElement.getAttribute("data-src");
+ }
}
}
- if (!link && !name) {
+ if (!link && !name && !imgSrc) {
return;
}
- // 支持解析 https://github.com/siyuan-note/siyuan/issues/11463
- value = oldValue.mAsset.concat({
- type: "file",
- content: link,
- name
- });
+ if (imgSrc) {
+ // 支持解析 ![]() https://github.com/siyuan-note/siyuan/issues/11487
+ value = oldValue.mAsset.concat({
+ type: "image",
+ content: imgSrc,
+ name: ""
+ });
+ } else {
+ // 支持解析 https://github.com/siyuan-note/siyuan/issues/11463
+ value = oldValue.mAsset.concat({
+ type: "file",
+ content: link,
+ name
+ });
+ }
}
} else if (type === "mSelect") {
// 不传入为删除