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/10049
Vanessa978f14147ec7
diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.tsindex 4655e10bb9..705c0771cf 100644--- a/app/src/protyle/render/av/action.ts+++ b/app/src/protyle/render/av/action.ts@@ -214,7 +214,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle}const cellType = getTypeByCellElement(target);// TODO 点击单元格的时候, lineNumber 选中整行- if (cellType === "updated" || cellType === "created" || cellType === "lineNumber" || (cellType === "block" && !target.getAttribute("data-detached"))) {+ if (cellType === "updated" || cellType === "created" || cellType === "lineNumber") {selectRow(rowElement.querySelector(".av__firstcol"), "toggle");} else {scrollElement.querySelectorAll(".av__row--select").forEach(item => {@@ -584,18 +584,9 @@ ${window.siyuan.languages.insertRowAfter.replace("${x}", `<span class="fn__space});const editAttrSubmenu: IMenu[] = [];rowElement.parentElement.querySelectorAll(".av__row--header .av__cell").forEach((cellElement: HTMLElement) => {- let hideBlock = false;const selectElements: HTMLElement[] = Array.from(blockElement.querySelectorAll(`.av__row--select:not(.av__row--header) .av__cell[data-col-id="${cellElement.dataset.colId}"]`));- if (cellElement.dataset.dtype === "block") {- selectElements.find(item => {- if (!item.dataset.detached) {- hideBlock = true;- return true;- }- });- }const type = cellElement.getAttribute("data-dtype") as TAVCol;- if (!hideBlock && !["updated", "created"].includes(type)) {+ if (!["updated", "created"].includes(type)) {const icon = cellElement.dataset.icon;editAttrSubmenu.push({iconHTML: icon ? unicode2Emoji(icon, "b3-menu__icon", true) : `<svg class="b3-menu__icon"><use xlink:href="#${getColIconByType(type)}"></use></svg>`,diff --git a/app/src/protyle/render/av/blockAttr.ts b/app/src/protyle/render/av/blockAttr.tsindex 38ae9e9b1e..6188102f81 100644--- a/app/src/protyle/render/av/blockAttr.ts+++ b/app/src/protyle/render/av/blockAttr.ts@@ -61,7 +61,7 @@ export const genAVValueHTML = (value: IAVCellValue) => {let html = "";switch (value.type) {case "block":- html = `<div class="fn__flex-1" placeholder="${window.siyuan.languages.empty}">${value.block.content}</div>`;+ html = `<input value="${value.block.content}" type="text" class="b3-text-field b3-text-field--text fn__flex-1" placeholder="${window.siyuan.languages.empty}">`;break;case "text":html = `<textarea style="resize: vertical" rows="${value.text.content.split("\n").length}" class="b3-text-field b3-text-field--text fn__flex-1" placeholder="${window.siyuan.languages.empty}">${value.text.content}</textarea>`;@@ -198,7 +198,7 @@ export const renderAVAttribute = (element: HTMLElement, id: string, protyle: IPr<div data-av-id="${table.avID}" data-col-id="${item.values[0].keyID}" data-block-id="${item.values[0].blockID}" data-id="${item.values[0].id}" data-type="${item.values[0].type}"data-options="${item.key?.options ? escapeAttr(JSON.stringify(item.key.options)) : "[]"}"${["text", "number", "date", "url", "phone", "template", "email"].includes(item.values[0].type) ? "" : `placeholder="${window.siyuan.languages.empty}"`}-class="fn__flex-1 fn__flex${["url", "text", "number", "email", "phone"].includes(item.values[0].type) ? "" : " custom-attr__avvalue"}${["block", "created", "updated"].includes(item.values[0].type) ? " custom-attr__avvalue--readonly" : ""}">${genAVValueHTML(item.values[0])}</div>+class="fn__flex-1 fn__flex${["url", "text", "number", "email", "phone", "block"].includes(item.values[0].type) ? "" : " custom-attr__avvalue"}${["created", "updated"].includes(item.values[0].type) ? " custom-attr__avvalue--readonly" : ""}">${genAVValueHTML(item.values[0])}</div></div>`;});innerHTML += `<div class="fn__hr"></div>diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.tsindex 96d3e4c735..66155dded3 100644--- a/app/src/protyle/render/av/cell.ts+++ b/app/src/protyle/render/av/cell.ts@@ -275,7 +275,11 @@ export const genCellValue = (colType: TAVCol, value: string | any) => {}}if (colType === "block") {- cellValue.isDetached = true;+ if (typeof value === "object" && value.id) {+ cellValue.isDetached = false;+ } else {+ cellValue.isDetached = true;+ }}return cellValue;};@@ -365,9 +369,6 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], typeif (type === "updated" || type === "created" || document.querySelector(".av__mask")) {return;}- if (type === "block" && (cellElements.length > 1 || !cellElements[0].getAttribute("data-detached"))) {- return;- }const blockElement = hasClosestBlock(cellElements[0]);if (!blockElement) {return;@@ -688,6 +689,11 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va});newValue = oldValue.mSelect.concat(newMSelectValue);}+ } else if (type === "block" && typeof value === "string" && oldValue.block.id) {+ newValue = {+ content: value,+ id: oldValue.block.id+ };}const cellValue = genCellValue(type, newValue);cellValue.id = cellId;@@ -703,26 +709,16 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, vaif (objEquals(cellValue, oldValue)) {return;}- if (type === "block" && !item.dataset.detached) {- const newId = Lute.NewNodeID();- doOperations.push({- action: "unbindAttrViewBlock",- id: rowID,- nextID: newId,- avID,- });- rowElement.dataset.id = newId;- item.dataset.blockId = newId;- } else {- doOperations.push({- action: "updateAttrViewCell",- id: cellId,- avID,- keyID: colId,- rowID,- data: cellValue- });- }++ doOperations.push({+ action: "updateAttrViewCell",+ id: cellId,+ avID,+ keyID: colId,+ rowID,+ data: cellValue+ });+undoOperations.push({action: "updateAttrViewCell",id: cellId,