Browse Source

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

Vanessa 1 năm trước cách đây
mục cha
commit
1860b641f0
1 tập tin đã thay đổi với 22 bổ sung7 xóa
  1. 22 7
      app/src/protyle/render/av/cell.ts

+ 22 - 7
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") {
             // 不传入为删除