Skip to content

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

:bug: 粘贴到关联cell报错

Vanessa3c8baa1d9f2e
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts
index e898d992dd..12e6c53bbf 100644
--- a/app/src/protyle/render/av/cell.ts
+++ b/app/src/protyle/render/av/cell.ts
@@ -44,7 +44,7 @@ export const genCellValueByElement = (colType: TAVCol, cellElement: HTMLElement)
};
} else if (["text", "block", "url", "phone", "email", "template"].includes(colType)) {
cellValue[colType as "text"] = {
- content: cellElement.querySelector(".av__celltext").textContent.trim()
+ content: cellElement.querySelector(".av__celltext").textContent
};
} else if (colType === "mSelect" || colType === "select") {
const mSelect: IAVCellSelectValue[] = [];
@@ -120,11 +120,6 @@ export const genCellValue = (colType: TAVCol, value: string | any) => {
checked: true
}
};
- } else if (colType === "relation") {
- cellValue = {
- type: colType,
- relation: {blockIDs: [], contents: [value]}
- };
}
} else if (typeof value === "undefined" || !value) {
if (colType === "number") {
@@ -434,7 +429,7 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va
item = cellElements[elementIndex] = nodeElement.querySelector(`.av__row[data-id="${rowElement.dataset.id}"] .av__cell[data-col-id="${item.dataset.colId}"]`) as HTMLElement;
}
const type = getTypeByCellElement(item) || item.dataset.type as TAVCol;
- if (["created", "updated", "template"].includes(type)) {
+ if (["created", "updated", "template", "rollup"].includes(type)) {
return;
}
@@ -463,6 +458,10 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va
}
const cellValue = genCellValue(type, value);
cellValue.id = cellId;
+ if ((cellValue.type === "date" && typeof cellValue.date === "string") ||
+ (cellValue.type === "relation" && typeof cellValue.relation === "string")) {
+ return;
+ }
if (objEquals(cellValue, oldValue)) {
return;
}
diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts
index 22f41b05b0..58d35f6630 100644
--- a/app/src/types/index.d.ts
+++ b/app/src/types/index.d.ts
@@ -1158,6 +1158,7 @@ interface IAVCellDateValue {
content2?: number,
isNotEmpty2?: boolean
hasEndDate?: boolean
+ formattedContent?: string,
isNotTime?: boolean // 默认 true
}