From 3c8baa1d9f2e11670dac7ba31c49a64ea4158de4 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 4 Jan 2024 17:33:54 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E7=B2=98=E8=B4=B4=E5=88=B0=E5=85=B3?= =?UTF-8?q?=E8=81=94cell=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/protyle/render/av/cell.ts | 13 ++++++------- app/src/types/index.d.ts | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts index e898d992d..12e6c53bb 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 22f41b05b..58d35f663 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 }