Skip to content

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

:bug: Restore subdocument creation in table cells https://github.com/siyuan-note/siyuan/issues/19671

Danielae804c6b34f2
diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.ts
index d76b9c608d..4e842f41b9 100644
--- a/app/src/protyle/hint/extend.ts
+++ b/app/src/protyle/hint/extend.ts
@@ -558,6 +558,12 @@ export const hintRef = (key: string, protyle: IProtyle, source: THintSource): IH
let refParam: import("../../types/api").SearchRefBlockRequestInput;
if (protyle.lite) {
refParam = {k: key, id: "", rootID: "", beforeLen: 48, isDatabase: false, isSquareBrackets: true};
+ // 单元格内的临时块不在块树中,使用所属表格提供搜索和新建文档的上下文
+ if (protyle.path && protyle.block.parentID) {
+ refParam.id = protyle.block.parentID;
+ refParam.rootID = protyle.block.rootID;
+ refParam.isSquareBrackets = ["[[", "【【"].includes(protyle.hint.splitChar);
+ }
} else {
refParam = {
k: key,
diff --git a/app/src/protyle/render/tableCellRichEditor.ts b/app/src/protyle/render/tableCellRichEditor.ts
index 89ac1cfbd0..0ee061571e 100644
--- a/app/src/protyle/render/tableCellRichEditor.ts
+++ b/app/src/protyle/render/tableCellRichEditor.ts
@@ -194,6 +194,8 @@ export const openTableCellRichEditor = (owner: IProtyle, cell: HTMLTableCellElem
},
});
fragment.protyle.block.rootID = owner.block.rootID;
+ fragment.protyle.block.parentID = table.dataset.nodeId;
+ fragment.protyle.path = owner.path;
const commit = () => {
if (!cell.isConnected || !table.isConnected || !host.isConnected || owner.disabled || composing) {
return;