This commit is contained in:
Vanessa 2024-01-16 10:56:55 +08:00
parent ac952ee2bc
commit fd41b3b50f
3 changed files with 15 additions and 15 deletions

View file

@ -692,23 +692,23 @@ export const dragFillCellsValue = (protyle: IProtyle, nodeElement: HTMLElement,
const value: IAVCellValue & {
colId?: string,
element?: HTMLElement
} = genCellValueByElement(getTypeByCellElement(item), item)
} = genCellValueByElement(getTypeByCellElement(item), item);
value.colId = item.dataset.colId;
value.element = item;
newData[rowElement.dataset.id].push(value);
})
});
const doOperations: IOperation[] = [];
const undoOperations: IOperation[] = [];
const avID = nodeElement.dataset.avId
const avID = nodeElement.dataset.avId;
const originKeys = Object.keys(originData);
Object.keys(newData).forEach((rowID, index) => {
newData[rowID].forEach((item, cellIndex) => {
if (["rollup", "template", "created", "updated"].includes(item.type)) {
return;
}
const data = originData[originKeys[index % originKeys.length]][cellIndex]
const data = originData[originKeys[index % originKeys.length]][cellIndex];
data.id = item.id;
const keyID = item.colId
const keyID = item.colId;
if (data.type === "block") {
data.isDetached = true;
delete data.block.id;
@ -732,10 +732,10 @@ export const dragFillCellsValue = (protyle: IProtyle, nodeElement: HTMLElement,
rowID,
data: item
});
})
});
});
focusBlock(nodeElement);
if (doOperations.length > 0) {
transaction(protyle, doOperations, undoOperations);
}
}
};

View file

@ -26,7 +26,7 @@ export const avKeydown = (event: KeyboardEvent, nodeElement: HTMLElement, protyl
nodeElement.querySelectorAll(".av__cell--active").forEach(item => {
item.classList.remove("av__cell--active");
item.querySelector(".av__drag-fill")?.remove();
})
});
if (event.key === "Escape") {
selectCellElement.classList.remove("av__cell--select");
selectRow(rowElement.querySelector(".av__firstcol"), "select");