Skip to content

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

:art: attr https://github.com/siyuan-note/siyuan/issues/9667

Vanessadc5551aea86c
diff --git a/app/src/protyle/render/av/blockAttr.ts b/app/src/protyle/render/av/blockAttr.ts
index 3ec224b26f..4d7d9ef426 100644
--- a/app/src/protyle/render/av/blockAttr.ts
+++ b/app/src/protyle/render/av/blockAttr.ts
@@ -56,6 +56,9 @@ export const genAVValueHTML = (value: IAVCellValue) => {
<span class="fn__space"></span>
<a href="tel:${value.phone.content}" target="_blank" aria-label="${window.siyuan.languages.openBy}" class="block__icon block__icon--show fn__flex-center b3-tooltips__w b3-tooltips"><svg><use xlink:href="#iconPhone"></use></svg></a>`;
break;
+ case "checkbox":
+ html = `<svg class="av__checkbox" style="height: 17px;"><use xlink:href="#icon${value.checkbox.checked?"Check":"Uncheck"}"></use></svg>`;
+ break;
case "template":
html = `<div class="fn__flex-1">${value.template.content}</div>`;
break;
@@ -76,9 +79,17 @@ export const renderAVAttribute = (element: HTMLElement, id: string, protyle?: IP
key: {
type: TAVCol,
name: string,
- options?: { name: string, color: string }[]
+ options?: {
+ name: string,
+ color: string
+ }[]
},
- values: { keyID: string, id: string, blockID: string, type?: TAVCol & IAVCellValue } []
+ values: {
+ keyID: string,
+ id: string,
+ blockID: string,
+ type?: TAVCol & IAVCellValue
+ } []
}[],
blockIDs: string[],
avID: string
@@ -128,6 +139,13 @@ class="fn__flex-1 fn__flex${["url", "text", "number", "email", "phone"].includes
event.preventDefault();
return;
}
+ const checkboxElement = hasClosestByAttribute(target, "data-type", "checkbox");
+ if (checkboxElement) {
+ popTextCell(protyle, [checkboxElement], "checkbox");
+ event.stopPropagation();
+ event.preventDefault();
+ return;
+ }
});
element.querySelectorAll(".b3-text-field--text").forEach((item: HTMLInputElement) => {
item.addEventListener("change", () => {
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts
index e7b219720f..ff5ca7e8df 100644
--- a/app/src/protyle/render/av/cell.ts
+++ b/app/src/protyle/render/av/cell.ts
@@ -339,13 +339,17 @@ const updateCellValue = (protyle: IProtyle, type: TAVCol, cellElements: HTMLElem
id,
data: blockElement.getAttribute("updated"),
});
- updateAttrViewCellAnimation(item);
+ if (!hasClosestByClassName(cellElements[0], "custom-attr")) {
+ updateAttrViewCellAnimation(item);
+ }
});
}
if (doOperations.length > 0) {
transaction(protyle, doOperations, undoOperations);
}
- cellElements[0].classList.add("av__cell--select");
+ if (!hasClosestByClassName(cellElements[0], "custom-attr")) {
+ cellElements[0].classList.add("av__cell--select");
+ }
if (blockElement) {
focusBlock(blockElement);
}