Skip to content

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

:bug: Handle custom table detection outside blocks https://github.com/siyuan-note/siyuan/issues/18913

Daniel4f106dfbcf46
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index df898d314a..446ef93a1a 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -1078,7 +1078,8 @@ export class WYSIWYG {
let target = event.target as HTMLElement;
const customElement = hasClosestByClassName(target, "protyle-custom");
let nodeElement = hasClosestBlock(target) as HTMLElement;
- let clickedTableNode = !customElement && nodeElement?.dataset.type === "NodeTable" ? nodeElement : undefined;
+ let clickedTableNode = !customElement && nodeElement && nodeElement.dataset.type === "NodeTable" ?
+ nodeElement : undefined;
if (!nodeElement && !customElement) {
clickedTableNode = Array.from(this.element.querySelectorAll<HTMLElement>(
'[data-type="NodeTable"]')).find(item => {