An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: fix https://github.com/siyuan-note/siyuan/issues/11463
Vanessa4e8550beb92e
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.tsindex 9463057e2f..004dae8f84 100644--- a/app/src/protyle/render/av/cell.ts+++ b/app/src/protyle/render/av/cell.ts@@ -516,7 +516,7 @@ const updateCellValueByInput = (protyle: IProtyle, type: TAVCol, blockElement: H};export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, value?: any, cElements?: HTMLElement[],- columns?: IAVColumn[]) => {+ columns?: IAVColumn[], html?: string) => {const doOperations: IOperation[] = [];const undoOperations: IOperation[] = [];@@ -569,9 +569,27 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, vaif (type === "mAsset") {if (Array.isArray(value)) {value = oldValue.mAsset.concat(value);- } else if (typeof value !== "undefined") {- // 不传入为删除,传入字符串不进行处理- return;+ } else if (typeof value !== "undefined") { // 不传入为删除,传入字符串不进行处理+ let link = protyle.lute.GetLinkDest(value);+ let name = "";+ if (html) {+ const tempElement = document.createElement("template")+ tempElement.innerHTML = html+ const aElement = tempElement.content.querySelector('[data-type~="a"]')+ if (aElement) {+ link = aElement.getAttribute("data-href");+ name = aElement.textContent+ }+ }+ if (!link && !name) {+ return;+ }+ // 支持解析 https://github.com/siyuan-note/siyuan/issues/11463+ value = oldValue.mAsset.concat({+ type: "file",+ content: link,+ name+ });}} else if (type === "mSelect") {// 不传入为删除diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.tsindex 325cfba50d..aed8df2189 100644--- a/app/src/protyle/util/insertHTML.ts+++ b/app/src/protyle/util/insertHTML.ts@@ -176,9 +176,9 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement:const rowsElement = blockElement.querySelector(".av__row--select");if (rowsElement) {- updateCellsValue(protyle, blockElement as HTMLElement, text, undefined, columns);+ updateCellsValue(protyle, blockElement as HTMLElement, text, undefined, columns, html);} else if (cellsElement.length > 0) {- updateCellsValue(protyle, blockElement as HTMLElement, text, cellsElement, columns);+ updateCellsValue(protyle, blockElement as HTMLElement, text, cellsElement, columns, html);} else if (hasClosestByClassName(range.startContainer, "av__title")) {range.insertNode(document.createTextNode(text));range.collapse(false);diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex 4150da378b..536761832e 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -1577,7 +1577,7 @@ export class WYSIWYG {blockElement: hasClosestBlock(assetImgElement) as HTMLElement,content: target.tagName === "IMG" ? target.getAttribute("src") : target.getAttribute("data-url"),type: target.tagName === "IMG" ? "image" : "file",- name: target.tagName === "IMG" ? "" : target.textContent,+ name: target.tagName === "IMG" ? "" : target.getAttribute("data-name"),index,rect: target.getBoundingClientRect()});