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: fix https://github.com/siyuan-note/siyuan/issues/10262
Vanessa66acf8576d1b
diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.tsindex 3c844a327d..806f3e6651 100644--- a/app/src/protyle/render/av/action.ts+++ b/app/src/protyle/render/av/action.ts@@ -3,7 +3,7 @@ import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName} from "../import {transaction} from "../../wysiwyg/transaction";import {openEditorTab} from "../../../menus/util";import {copySubMenu} from "../../../menus/commonMenuItem";-import {getCellText, getTypeByCellElement, popTextCell, renderCell, updateHeaderCell} from "./cell";+import {getCellText, getTypeByCellElement, popTextCell, renderCell, renderCellAttr, updateHeaderCell} from "./cell";import {getColIconByType, showColMenu} from "./col";import {deleteRow, insertAttrViewBlockAnimation, setPageSize, updateHeader} from "./row";import {emitOpenMenu} from "../../../plugin/EventBus";@@ -400,6 +400,7 @@ export const updateAttrViewCellAnimation = (cellElement: HTMLElement, value: IAVupdateHeaderCell(cellElement, headerValue);} else {cellElement.innerHTML = renderCell(value);+ renderCellAttr(cellElement, value);}};diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.tsindex 48381bc58d..21d74da031 100644--- a/app/src/protyle/render/av/cell.ts+++ b/app/src/protyle/render/av/cell.ts@@ -517,6 +517,23 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, vareturn text;};+export const renderCellAttr = (cellElement: Element, value: IAVCellValue) => {+ if (value.type === "checkbox") {+ if (value.checkbox.checked) {+ cellElement.classList.add("av__cell-check");+ cellElement.classList.remove("av__cell-uncheck");+ } else {+ cellElement.classList.remove("av__cell-check");+ cellElement.classList.add("av__cell-uncheck");+ }+ } else if (value.type === "block") {+ cellElement.setAttribute("data-block-id", value.block.id || "");+ if (value.isDetached) {+ cellElement.setAttribute("data-detached", "true");+ }+ }+}+export const renderCell = (cellValue: IAVCellValue) => {let text = "";if (["text", "template"].includes(cellValue.type)) {@@ -722,6 +739,7 @@ export const dragFillCellsValue = (protyle: IProtyle, nodeElement: HTMLElement,data});item.element.innerHTML = renderCell(data);+ renderCellAttr(item.element, data);delete item.colId;delete item.element;undoOperations.push({diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.tsindex af67b584e1..f934febe86 100644--- a/app/src/protyle/render/av/render.ts+++ b/app/src/protyle/render/av/render.ts@@ -130,7 +130,12 @@ style="width: ${index === 0 ? ((parseInt(column.width || "200") + 24) + "px") :if (data.columns[index].hidden) {return;}- tableHTML += `<div class="av__cell" data-id="${cell.id}" data-col-id="${data.columns[index].id}"+ // https://github.com/siyuan-note/siyuan/issues/10262+ let checkClass = ""+ if (cell.valueType === "checkbox") {+ checkClass = cell.value?.checkbox?.checked ? " av__cell-check" : " av__cell-uncheck";+ }+ tableHTML += `<div class="av__cell${checkClass}" data-id="${cell.id}" data-col-id="${data.columns[index].id}"${cell.valueType === "block" ? 'data-block-id="' + (cell.value.block.id || "") + '"' : ""} data-wrap="${data.columns[index].wrap}"${cell.value?.isDetached ? ' data-detached="true"' : ""}style="width: ${data.columns[index].width || "200px"};@@ -302,7 +307,12 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => {// 更新属性面板renderAVAttribute(attrElement.parentElement, attrElement.dataset.nodeId, protyle, (newElment) => {if (operation.action === "addAttrViewCol") {- openMenuPanel({protyle, blockElement: newElment.querySelector(`div[data-av-id="${operation.avID}"]`), type: "edit", colId: operation.id});+ openMenuPanel({+ protyle,+ blockElement: newElment.querySelector(`div[data-av-id="${operation.avID}"]`),+ type: "edit",+ colId: operation.id+ });}});}diff --git a/app/src/protyle/render/av/row.ts b/app/src/protyle/render/av/row.tsindex 3aa126f5cf..2c4d7c4ced 100644--- a/app/src/protyle/render/av/row.ts+++ b/app/src/protyle/render/av/row.ts@@ -2,7 +2,7 @@ import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";import {focusBlock} from "../../util/selection";import {Menu} from "../../../plugin/Menu";import {transaction} from "../../wysiwyg/transaction";-import {genCellValueByElement, getTypeByCellElement, popTextCell, renderCell} from "./cell";+import {genCellValueByElement, getTypeByCellElement, popTextCell, renderCell, renderCellAttr} from "./cell";import {fetchPost} from "../../../util/fetch";export const selectRow = (checkElement: Element, type: "toggle" | "select" | "unselect" | "unselectAll") => {@@ -108,13 +108,17 @@ ${(item.getAttribute("data-block-id") || item.dataset.dtype === "block") ? ' datfetchPost("/api/av/getAttributeViewFilterSort", {id: avId}, (response) => {response.data.filters.forEach((item: IAVFilter) => {const sideRowCellElement = sideRow.querySelector(`.av__cell[data-col-id="${item.column}"]`) as HTMLElement;- currentRow.querySelector(`.av__cell[data-col-id="${item.column}"]`).innerHTML =- renderCell(genCellValueByElement(getTypeByCellElement(sideRowCellElement), sideRowCellElement));+ const cellElement = currentRow.querySelector(`.av__cell[data-col-id="${item.column}"]`);+ const cellValue = genCellValueByElement(getTypeByCellElement(sideRowCellElement), sideRowCellElement);+ cellElement.innerHTML = renderCell(cellValue);+ renderCellAttr(cellElement, cellValue);});response.data.sorts.forEach((item: IAVSort) => {const sideRowCellElement = sideRow.querySelector(`.av__cell[data-col-id="${item.column}"]`) as HTMLElement;- currentRow.querySelector(`.av__cell[data-col-id="${item.column}"]`).innerHTML =- renderCell(genCellValueByElement(getTypeByCellElement(sideRowCellElement), sideRowCellElement));+ const cellElement = currentRow.querySelector(`.av__cell[data-col-id="${item.column}"]`);+ const cellValue = genCellValueByElement(getTypeByCellElement(sideRowCellElement), sideRowCellElement);+ cellElement.innerHTML = renderCell(cellValue);+ renderCellAttr(cellElement, cellValue);});popTextCell(protyle, [currentRow.querySelector('.av__cell[data-detached="true"]')], "block");});