mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
This commit is contained in:
parent
4518752f29
commit
baa003027b
2 changed files with 10 additions and 7 deletions
|
|
@ -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(/</g, "<").replace(/>/g, ">"));
|
||||
});
|
||||
nodeElement.outerHTML = nodeElement.innerHTML;
|
||||
nodeElement.replaceWith(nodeElement.firstElementChild);
|
||||
if (range) {
|
||||
focusByWbr(protyle.wysiwyg.element, range);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue