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/11409

Vanessa1c45347de52b
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts
index d9cec86d4f..dbae546455 100644
--- a/app/src/protyle/render/av/cell.ts
+++ b/app/src/protyle/render/av/cell.ts
@@ -13,6 +13,7 @@ import {genAVValueHTML} from "./blockAttr";
import {Constants} from "../../../constants";
import {hintRef} from "../../hint/extend";
import {pathPosix} from "../../../util/pathName";
+import {mergeAddOption} from "./select";
const renderCellURL = (urlContent: string) => {
let host = urlContent;
@@ -587,6 +588,11 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va
(cellValue.type === "relation" && typeof cellValue.relation === "string")) {
return;
}
+ if (type === "select" || type === "mSelect") {
+ const operations = mergeAddOption(columns.find(e => e.id === colId), cellValue, avID);
+ doOperations.push(...operations.doOperations);
+ undoOperations.push(...operations.undoOperations);
+ }
if (objEquals(cellValue, oldValue)) {
return;
}
diff --git a/app/src/protyle/render/av/select.ts b/app/src/protyle/render/av/select.ts
index 0e966b4920..269e915c45 100644
--- a/app/src/protyle/render/av/select.ts
+++ b/app/src/protyle/render/av/select.ts
@@ -566,7 +566,7 @@ export const getSelectHTML = (data: IAVTable, cellElements: HTMLElement[], init
</div>`;
};
-export const mergeAddOption = (column: IAVColumn, cellValue: IAVCellValue, avID:string) => {
+export const mergeAddOption = (column: IAVColumn, cellValue: IAVCellValue, avID: string) => {
const doOperations: IOperation[] = [];
const undoOperations: IOperation[] = [];
cellValue.mSelect.forEach((item: IAVCellSelectValue) => {
@@ -580,15 +580,17 @@ export const mergeAddOption = (column: IAVColumn, cellValue: IAVCellValue, avID:
}
});
if (!needAdd) {
+ const newColor = ((column.options?.length || 0) % 13 + 1).toString()
column.options.push({
name: item.content,
- color:(column.options?.length || 0) % 13 + 1
+ color: newColor
});
+ item.color = newColor;
doOperations.push({
action: "updateAttrViewColOptions",
id: column.id,
avID,
- data: column.options
+ data: column.options
})
undoOperations.push({
action: "removeAttrViewColOption",