Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/14394#issuecomment-4753227205

Daniel28b7fcd76cf9
diff --git a/app/src/protyle/render/av/calc.ts b/app/src/protyle/render/av/calc.ts
index 7dd01d30a9..92f7dc2027 100644
--- a/app/src/protyle/render/av/calc.ts
+++ b/app/src/protyle/render/av/calc.ts
@@ -450,9 +450,10 @@ export const openCalcMenu = async (protyle: IProtyle, calcElement: HTMLElement,
const colData = getFieldsByData(avResponse.data).find((item) => item.id === colId);
currentTemplate = colData?.calc?.template || "";
}
- // 提交模板统计:将底部计算切换为 Template 并写入模板内容
+ // 提交模板统计:将底部计算切换为 Template 并写入模板内容;模板为空时恢复为“无”
const submitTemplate = (templateContent: string) => {
- const doData: IAVCalc = {operator: "Template", template: templateContent};
+ const isEmpty = "" === templateContent.trim();
+ const doData: IAVCalc = isEmpty ? {operator: ""} : {operator: "Template", template: templateContent};
const undoData: IAVCalc = {operator: oldOperator || ""};
if (oldOperator === "Template" && currentTemplate) {
undoData.template = currentTemplate;