Vanessa 2025-11-07 00:06:20 +08:00
parent 4518752f29
commit baa003027b
2 changed files with 10 additions and 7 deletions

View file

@ -50,11 +50,7 @@ export const cancelSB = async (protyle: IProtyle, nodeElement: Element, range?:
getContenteditableElement(nodeElement).insertAdjacentHTML("afterbegin", "<wbr>");
}
nodeElement.lastElementChild.remove();
// 超级块中的 html 块需要反转义再赋值 https://github.com/siyuan-note/siyuan/issues/13155
nodeElement.querySelectorAll("protyle-html").forEach(item => {
item.setAttribute("data-content", item.getAttribute("data-content").replace(/&lt;/g, "<").replace(/&gt;/g, ">"));
});
nodeElement.outerHTML = nodeElement.innerHTML;
nodeElement.replaceWith(nodeElement.firstElementChild);
if (range) {
focusByWbr(protyle.wysiwyg.element, range);
}

View file

@ -305,17 +305,24 @@ const dragSb = async (protyle: IProtyle, sourceElements: Element[], targetElemen
doOperations.push(...moveToResult.doOperations);
undoOperations.push(...moveToResult.undoOperations);
const newSourceParentElement = moveToResult.newSourceElements;
let removeIndex = doOperations.length - 1;
doOperations.find((item, index) => {
if (item.action === "delete" && item.id === targetMoveUndo.parentID) {
removeIndex = index;
return true;
}
});
if (isBottom) {
// 拖拽到超级块 col 下方, 其他块右侧
sbElement.insertAdjacentElement("afterbegin", targetElement);
doOperations.push({
doOperations.splice(removeIndex, 0, {
action: "move",
id: targetElement.getAttribute("data-node-id"),
parentID: sbElement.getAttribute("data-node-id")
});
} else {
sbElement.lastElementChild.insertAdjacentElement("beforebegin", targetElement);
doOperations.push({
doOperations.splice(removeIndex, 0, {
action: "move",
id: targetElement.getAttribute("data-node-id"),
previousID: newSourceParentElement[0].getAttribute("data-node-id"),