This commit is contained in:
Vanessa 2024-01-05 09:30:54 +08:00
parent 092a16b50b
commit 2e850de49e
2 changed files with 2 additions and 18 deletions

View File

@ -108,15 +108,7 @@ export const updateAssetCell = (options: {
if (!options.blockElement.contains(item)) {
const rowElement = hasClosestByClassName(item, "av__row");
if (rowElement) {
let cellIndex: number;
rowElement.querySelectorAll(".av__cell").forEach((cellElement: HTMLElement, ghostIndex) => {
if (cellElement.dataset.id === item.dataset.id) {
cellIndex = ghostIndex
}
});
if (typeof cellIndex === "number") {
item = options.cellElements[elementIndex] = options.blockElement.querySelectorAll(`.av__row[data-id="${rowElement.dataset.id}"] .av__cell`)[cellIndex] as HTMLElement;
}
item = options.cellElements[elementIndex] = options.blockElement.querySelector(`.av__row[data-id="${rowElement.dataset.id}"] .av__cell[data-col-id="${item.dataset.colId}"]`) as HTMLElement
}
}
const cellValue = genCellValueByElement(getTypeByCellElement(item) || item.dataset.type as TAVCol, item);

View File

@ -432,15 +432,7 @@ export const addColOptionOrCell = (protyle: IProtyle, data: IAV, cellElements: H
cellElements.forEach((item, index) => {
const rowElement = hasClosestByClassName(item, "av__row");
if (rowElement) {
let cellIndex: number;
rowElement.querySelectorAll(".av__cell").forEach((cellElement: HTMLElement, ghostIndex) => {
if (cellElement.dataset.id === item.dataset.id) {
cellIndex = ghostIndex
}
});
if (typeof cellIndex === "number") {
cellElements[index] = blockElement.querySelectorAll(`.av__row[data-id="${rowElement.dataset.id}"] .av__cell`)[cellIndex] as HTMLElement;
}
cellElements[index] = blockElement.querySelector(`.av__row[data-id="${rowElement.dataset.id}"] .av__cell[data-col-id="${item.dataset.colId}"]`) as HTMLElement;
}
});
}