An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: https://github.com/siyuan-note/siyuan/issues/8766
Vanessa37892e786b51
diff --git a/app/src/protyle/render/av/col.ts b/app/src/protyle/render/av/col.tsindex 0d5d059a0b..1349dbae30 100644--- a/app/src/protyle/render/av/col.ts+++ b/app/src/protyle/render/av/col.ts@@ -109,7 +109,7 @@ export const getEditHTML = (options: {html += `<button class="b3-menu__separator"></button><button class="b3-menu__item"><svg class="b3-menu__icon" style=""><use xlink:href="#iconAdd"></use></svg>- <span class="b3-menu__label"><input data-type="addOption" style="margin: 4px 0" class="b3-text-field" type="text" placeholder="Enter ${window.siyuan.languages.addAttr}"></span>+ <span class="b3-menu__label"><input data-type="addOption" style="margin: 4px 0" class="b3-text-field fn__block" type="text" placeholder="Enter ${window.siyuan.languages.addAttr}"></span></button>`;colData.options.forEach(item => {html += `<button class="b3-menu__item${html ? "" : " b3-menu__item--current"}" draggable="true" data-name="${item.name}" data-color="${item.color}">@@ -129,6 +129,11 @@ export const getEditHTML = (options: {<svg class="b3-menu__icon"><use xlink:href="#iconFormat"></use></svg><span class="b3-menu__label">${window.siyuan.languages.format}</span><span class="b3-menu__accelerator">${getLabelByNumberFormat(colData.numberFormat)}</span>+</button>`;+ } else if (colData.type === "template") {+ html += `<button class="b3-menu__separator"></button>+<button class="b3-menu__item">+ <textarea placeholder="${window.siyuan.languages.template}" data-type="updateTemplate" style="margin: 4px 0" cols="1" class="fn__block b3-text-field">${colData.template}</textarea></button>`;}return `<div class="b3-menu__items">@@ -185,6 +190,42 @@ export const bindEditEvent = (options: { protyle: IProtyle, data: IAV, menuElemeoptions.menuElement.parentElement.remove();}});++ const tplElement = options.menuElement.querySelector('[data-type="updateTemplate"]') as HTMLTextAreaElement+ if (tplElement) {+ tplElement.addEventListener("blur", () => {+ const newValue = tplElement.value;+ if (newValue === colData.template) {+ return;+ }+ transaction(options.protyle, [{+ action: "updateAttrViewColTemplate",+ id: colId,+ avID,+ data: newValue,+ type: colData.type,+ }], [{+ action: "updateAttrViewColTemplate",+ id: colId,+ avID,+ data: colData.template,+ type: colData.type,+ }]);+ colData.template = newValue;+ });+ tplElement.addEventListener("keydown", (event: KeyboardEvent) => {+ if (event.isComposing) {+ return;+ }+ if (event.key === "Escape") {+ options.menuElement.parentElement.remove();+ } else if (event.key === "Enter") {+ tplElement.dispatchEvent(new CustomEvent("blur"));+ options.menuElement.parentElement.remove();+ }+ });+ }+const addOptionElement = options.menuElement.querySelector('[data-type="addOption"]') as HTMLInputElement;if (!addOptionElement) {return;diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.tsindex 8dd42d65d7..3b08698d40 100644--- a/app/src/protyle/render/av/render.ts+++ b/app/src/protyle/render/av/render.ts@@ -63,7 +63,7 @@ style="width: ${column.width || "200px"}">${getCalcValue(column) || '<svg><use x}let text = "";if (["text", "template"].includes(cell.valueType)) {- text = `<span class="av__celltext">${cell.value ? cell.value[cell.valueType as "text"].content : ""}</span>`;+ text = `<span class="av__celltext">${cell.value ? (cell.value[cell.valueType as "text"].content || "") : ""}</span>`;} else if (["url", "email", "phone"].includes(cell.valueType)) {const urlContent = cell.value ? cell.value[cell.valueType as "url"].content : "";// https://github.com/siyuan-note/siyuan/issues/9291diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.tsindex 52cf18785e..4279e73c37 100644--- a/app/src/protyle/wysiwyg/transaction.ts+++ b/app/src/protyle/wysiwyg/transaction.ts@@ -708,7 +708,8 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:} else if (["addAttrViewCol", "insertAttrViewBlock", "updateAttrViewCol", "updateAttrViewColOptions","updateAttrViewColOption", "updateAttrViewCell", "sortAttrViewRow", "sortAttrViewCol", "setAttrViewColHidden","setAttrViewColWrap", "setAttrViewColWidth", "removeAttrViewColOption", "setAttrViewName", "setAttrViewFilters",- "setAttrViewSorts", "setAttrViewColCalc", "removeAttrViewCol", "updateAttrViewColNumberFormat", "replaceAttrViewBlock"].includes(operation.action)) {+ "setAttrViewSorts", "setAttrViewColCalc", "removeAttrViewCol", "updateAttrViewColNumberFormat",+ "replaceAttrViewBlock", "updateAttrViewColTemplate"].includes(operation.action)) {refreshAV(protyle, operation);}};diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.tsindex 8abc910f5f..2efa1243fe 100644--- a/app/src/types/index.d.ts+++ b/app/src/types/index.d.ts@@ -24,6 +24,7 @@ type TOperation =| "removeFlashcards"| "updateAttrViewCell"| "updateAttrViewCol"+ | "updateAttrViewColTemplate"| "sortAttrViewRow"| "sortAttrViewCol"| "setAttrViewColHidden"@@ -1022,6 +1023,7 @@ interface IAVColumn {hidden: boolean,type: TAVCol,numberFormat: string,+ template: string,calc: {operator: string,result: IAVCellValue