Vanessa 2023-06-07 11:55:45 +08:00
parent cdb0024664
commit 4a945303a4
2 changed files with 37 additions and 1 deletions

View file

@ -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,

View file

@ -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");
});
}
}