mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-05 16:28:49 +01:00
🐛 粘贴到关联cell报错
This commit is contained in:
parent
5c56c1c542
commit
3c8baa1d9f
2 changed files with 7 additions and 7 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
1
app/src/types/index.d.ts
vendored
1
app/src/types/index.d.ts
vendored
|
|
@ -1158,6 +1158,7 @@ interface IAVCellDateValue {
|
|||
content2?: number,
|
||||
isNotEmpty2?: boolean
|
||||
hasEndDate?: boolean
|
||||
formattedContent?: string,
|
||||
isNotTime?: boolean // 默认 true
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue