Skip to content

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

:bug: fix https://github.com/siyuan-note/siyuan/issues/5931

Vanessa968cc47df242
diff --git a/app/src/protyle/preview/index.ts b/app/src/protyle/preview/index.ts
index 0d501824ae..449d3ef7b8 100644
--- a/app/src/protyle/preview/index.ts
+++ b/app/src/protyle/preview/index.ts
@@ -258,7 +258,15 @@ export class Preview {
private processZHTable(element: HTMLElement) {
element.querySelectorAll("table").forEach(item => {
const headElement = item.querySelector("thead");
- item.querySelector("tbody").insertAdjacentElement("afterbegin", headElement.firstElementChild);
+ if (!headElement) {
+ return;
+ }
+ const tbodyElement = item.querySelector("tbody");
+ if (tbodyElement) {
+ tbodyElement.insertAdjacentElement("afterbegin", headElement.firstElementChild);
+ } else {
+ item.innerHTML = `<tbody>${headElement.innerHTML}</tbody>`;
+ }
headElement.remove();
});
}