This commit is contained in:
parent
781183e434
commit
ffbb1423b3
3 changed files with 27 additions and 13 deletions
|
@ -552,7 +552,6 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va
|
|||
if (["created", "updated", "template", "rollup"].includes(type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const rowID = rowElement.getAttribute("data-id");
|
||||
const cellId = item.dataset.id; // 刚创建时无 id,更新需和 oldValue 保持一致
|
||||
const colId = item.dataset.colId;
|
||||
|
@ -589,14 +588,25 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va
|
|||
if (objEquals(cellValue, oldValue)) {
|
||||
return;
|
||||
}
|
||||
doOperations.push({
|
||||
action: "updateAttrViewCell",
|
||||
id: cellId,
|
||||
avID,
|
||||
keyID: colId,
|
||||
rowID,
|
||||
data: cellValue
|
||||
});
|
||||
if (type === "block" && !item.dataset.detached) {
|
||||
const newId = Lute.NewNodeID()
|
||||
doOperations.push({
|
||||
action: "unbindAttrViewBlock",
|
||||
id: rowID,
|
||||
nextID: newId
|
||||
});
|
||||
rowElement.dataset.id = newId;
|
||||
item.dataset.blockId = newId;
|
||||
} else {
|
||||
doOperations.push({
|
||||
action: "updateAttrViewCell",
|
||||
id: cellId,
|
||||
avID,
|
||||
keyID: colId,
|
||||
rowID,
|
||||
data: cellValue
|
||||
});
|
||||
}
|
||||
undoOperations.push({
|
||||
action: "updateAttrViewCell",
|
||||
id: cellId,
|
||||
|
@ -718,7 +728,7 @@ export const renderCell = (cellValue: IAVCellValue, rowIndex = 0) => {
|
|||
}
|
||||
|
||||
if (["text", "template", "url", "email", "phone", "number", "date", "created", "updated", "lineNumber"].includes(cellValue.type) &&
|
||||
( cellValue.type === "lineNumber" || (cellValue && cellValue[cellValue.type as "url"].content))) {
|
||||
(cellValue.type === "lineNumber" || (cellValue && cellValue[cellValue.type as "url"].content))) {
|
||||
text += `<span ${cellValue.type !== "number" ? "" : 'style="right:auto;left:5px"'} data-type="copy" class="block__icon"><svg><use xlink:href="#iconCopy"></use></svg></span>`;
|
||||
}
|
||||
return text;
|
||||
|
@ -840,7 +850,8 @@ export const dragFillCellsValue = (protyle: IProtyle, nodeElement: HTMLElement,
|
|||
const originKeys = Object.keys(originData);
|
||||
Object.keys(newData).forEach((rowID, index) => {
|
||||
newData[rowID].forEach((item, cellIndex) => {
|
||||
if (["rollup", "template", "created", "updated"].includes(item.type)) {
|
||||
if (["rollup", "template", "created", "updated"].includes(item.type) ||
|
||||
(item.type === "block" && item.element.getAttribute("data-detached") !== "true")) {
|
||||
return;
|
||||
}
|
||||
// https://ld246.com/article/1707975507571 数据库下拉填充数据后异常
|
||||
|
|
|
@ -71,7 +71,8 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement:
|
|||
return true;
|
||||
}
|
||||
const type = getTypeByCellElement(cellElement) || cellElement.dataset.type as TAVCol;
|
||||
if (["created", "updated", "template", "rollup"].includes(type)) {
|
||||
if (["created", "updated", "template", "rollup"].includes(type) ||
|
||||
(type === "block" && !cellElement.dataset.detached)) {
|
||||
return;
|
||||
}
|
||||
const rowID = currentRowElement.getAttribute("data-id");
|
||||
|
@ -89,7 +90,8 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement:
|
|||
return;
|
||||
}
|
||||
cellValue = genCellValue(type, cellValue[cellValue.type as "text"].content.toString());
|
||||
} else if (cellValue.type === "block") {
|
||||
}
|
||||
if (cellValue.type === "block") {
|
||||
cellValue.isDetached = true;
|
||||
delete cellValue.block.id;
|
||||
}
|
||||
|
|
1
app/src/types/index.d.ts
vendored
1
app/src/types/index.d.ts
vendored
|
@ -50,6 +50,7 @@ type TOperation =
|
|||
| "updateAttrViewColRollup"
|
||||
| "hideAttrViewName"
|
||||
| "setAttrViewColDate"
|
||||
| "unbindAttrViewBlock"
|
||||
type TBazaarType = "templates" | "icons" | "widgets" | "themes" | "plugins"
|
||||
type TCardType = "doc" | "notebook" | "all"
|
||||
type TEventBus = "ws-main" | "sync-start" | "sync-end" | "sync-fail" |
|
||||
|
|
Loading…
Add table
Reference in a new issue