Vanessa 2024-07-04 17:27:36 +08:00
parent b351c39514
commit 9ba4afdf2f

View file

@ -2,7 +2,14 @@ import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";
import {focusBlock} from "../../util/selection";
import {Menu} from "../../../plugin/Menu";
import {transaction} from "../../wysiwyg/transaction";
import {genCellValueByElement, getTypeByCellElement, popTextCell, renderCell, renderCellAttr} from "./cell";
import {
addDragFill,
genCellValueByElement,
getTypeByCellElement,
popTextCell,
renderCell,
renderCellAttr
} from "./cell";
import {fetchPost} from "../../../util/fetch";
import {showMessage} from "../../../dialog/message";
import * as dayjs from "dayjs";
@ -125,9 +132,19 @@ ${getTypeByCellElement(item) === "block" ? ' data-detached="true"' : ""}><span c
});
let html = "";
srcIDs.forEach((id) => {
html += `<div class="av__row" data-type="ghost" data-id="${id}" data-avid="${avId}" data-previous-id="${previousId}">
const blockCellElement = blockElement.querySelector(`[data-block-id="${id}"]`)
if (!blockCellElement) {
html += `<div class="av__row" data-type="ghost" data-id="${id}" data-avid="${avId}" data-previous-id="${previousId}">
${colHTML}
</div>`;
} else {
blockElement.querySelectorAll(".av__cell--select, .av__cell--active").forEach(item => {
item.classList.remove("av__cell--select", "av__cell--active");
item.querySelector(".av__drag-fill")?.remove();
});
addDragFill(blockCellElement);
blockCellElement.classList.add("av__cell--select");
}
});
previousElement.insertAdjacentHTML("afterend", html);
if (avId) {