From 42c87d5a9b7eed5fa33c9b064f03d74557aa08c6 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 6 Oct 2023 10:56:30 +0800 Subject: [PATCH] :art: database --- app/src/protyle/render/av/cell.ts | 8 +++++++- app/src/protyle/render/av/render.ts | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts index 2ea990906..f17d32ba1 100644 --- a/app/src/protyle/render/av/cell.ts +++ b/app/src/protyle/render/av/cell.ts @@ -4,6 +4,7 @@ import {openMenuPanel} from "./openMenuPanel"; import {Menu} from "../../../plugin/Menu"; import {updateAttrViewCellAnimation} from "./action"; import {isCtrl} from "../../util/compatibility"; +import {objEquals} from "../../../util/functions"; export const getCalcValue = (column: IAVColumn) => { if (!column.calc || !column.calc.result) { @@ -438,6 +439,9 @@ const updateCellValue = (protyle: IProtyle, type: TAVCol, cellElements: HTMLElem inputValue.content = parseFloat(inputValue.content as string); inputValue.isNotEmpty = !!inputValue.content; } + if (objEquals(inputValue, oldValue)) { + return; + } doOperations.push({ action: "updateAttrViewCell", id: cellId, @@ -460,7 +464,9 @@ const updateCellValue = (protyle: IProtyle, type: TAVCol, cellElements: HTMLElem }); updateAttrViewCellAnimation(item); }); - transaction(protyle, doOperations, undoOperations); + if (doOperations.length > 0) { + transaction(protyle, doOperations, undoOperations); + } setTimeout(() => { avMaskElement.remove(); }); diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts index cffb18513..b7076d11a 100644 --- a/app/src/protyle/render/av/render.ts +++ b/app/src/protyle/render/av/render.ts @@ -84,7 +84,7 @@ style="width: ${column.width || "200px"}">${getCalcValue(column) || '${window.siyuan.languages.openBy}`; } } else if (cell.valueType === "number") { - text = `${cell.value?.number.formattedContent || ""}`; + text = `${cell.value?.number.formattedContent || ""}`; } else if (cell.valueType === "mSelect" || cell.valueType === "select") { cell.value?.mSelect?.forEach((item) => { text += `${item.content}`;