Skip to content

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

:sparkles: https://github.com/siyuan-note/siyuan/issues/7536

Vanessa4a945303a4f6
diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.ts
index 508badecb4..6b16a9c61b 100644
--- a/app/src/protyle/hint/index.ts
+++ b/app/src/protyle/hint/index.ts
@@ -32,6 +32,7 @@ import {processRender} from "../util/processCode";
import {AIChat} from "../../ai/chat";
import {isMobile} from "../../util/functions";
import {isCtrl} from "../util/compatibility";
+import {avRender} from "../render/av";
export class Hint {
public timeId: number;
@@ -683,6 +684,8 @@ ${unicode2Emoji(emoji.unicode)}</button>`;
nodeElement.querySelectorAll("colgroup col").forEach((item: HTMLElement) => {
item.style.minWidth = "60px";
});
+ } else if (nodeElement.classList.contains("av")) {
+ avRender(nodeElement)
}
transaction(protyle, [{
data: oldHTML,
diff --git a/app/src/protyle/render/av/index.ts b/app/src/protyle/render/av/index.ts
index a4028eac8d..1d15aeb4e3 100644
--- a/app/src/protyle/render/av/index.ts
+++ b/app/src/protyle/render/av/index.ts
@@ -1,3 +1,36 @@
-export const avRender = (element: Element) => {
+export const avRender = (element: Element) => {
+ let avElements: Element[] = [];
+ if (element.getAttribute("data-type") === "NodeAttributeView") {
+ // 编辑器内代码块编辑渲染
+ avElements = [element];
+ } else {
+ avElements = Array.from(element.querySelectorAll('[data-type="NodeAttributeView"]'));
+ }
+ if (avElements.length === 0) {
+ return;
+ }
+ if (avElements.length > 0) {
+ avElements.forEach((e: HTMLDivElement) => {
+ if (e.getAttribute("data-render") === "true") {
+ return;
+ }
+ const data = {
+ filter:{},
+ sorts: {},
+ columns:[{
+ id:"",
+ name:"",
+ type:"",
+ }],
+ rows:[{
+ id:"",
+ cells:[{
+ value:"",
+ }]
+ }]
+ }
+ e.setAttribute("data-render", "true");
+ });
+ }
}