Vanessa 2025-03-17 19:17:52 +08:00
parent 6d3b7777ac
commit 0ebd5d6d75

View file

@ -263,7 +263,21 @@ const promiseTransaction = () => {
const updateEmbed = (protyle: IProtyle, operation: IOperation) => {
let updatedEmbed = false;
protyle.wysiwyg.element.querySelectorAll(`[data-type="NodeBlockQueryEmbed"] [data-node-id="${operation.id}"]`).forEach((item) => {
const updateEmbedElements = Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-type="NodeBlockQueryEmbed"] [data-node-id="${operation.id}"]`))
if (updateEmbedElements.length === 0) {
const tempElement = document.createElement("template");
tempElement.innerHTML = operation.data;
protyle.wysiwyg.element.querySelectorAll('[data-type="NodeBlockQueryEmbed"]').forEach((item) => {
item.querySelectorAll(`.protyle-wysiwyg__embed`).forEach(embedBlockItem => {
const newTempElement = tempElement.content.querySelector(`[data-node-id="${embedBlockItem.getAttribute("data-id")}"]`)
if (newTempElement) {
updateEmbedElements.push(embedBlockItem.firstElementChild)
operation.data = newTempElement.outerHTML
}
});
});
}
updateEmbedElements.forEach((item) => {
const tempElement = document.createElement("div");
tempElement.innerHTML = operation.data;
tempElement.querySelectorAll('[contenteditable="true"]').forEach(editItem => {