mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 15:40:12 +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>");
|
getContenteditableElement(nodeElement).insertAdjacentHTML("afterbegin", "<wbr>");
|
||||||
}
|
}
|
||||||
nodeElement.lastElementChild.remove();
|
nodeElement.lastElementChild.remove();
|
||||||
// 超级块中的 html 块需要反转义再赋值 https://github.com/siyuan-note/siyuan/issues/13155
|
nodeElement.replaceWith(nodeElement.firstElementChild);
|
||||||
nodeElement.querySelectorAll("protyle-html").forEach(item => {
|
|
||||||
item.setAttribute("data-content", item.getAttribute("data-content").replace(/</g, "<").replace(/>/g, ">"));
|
|
||||||
});
|
|
||||||
nodeElement.outerHTML = nodeElement.innerHTML;
|
|
||||||
if (range) {
|
if (range) {
|
||||||
focusByWbr(protyle.wysiwyg.element, range);
|
focusByWbr(protyle.wysiwyg.element, range);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -305,17 +305,24 @@ const dragSb = async (protyle: IProtyle, sourceElements: Element[], targetElemen
|
||||||
doOperations.push(...moveToResult.doOperations);
|
doOperations.push(...moveToResult.doOperations);
|
||||||
undoOperations.push(...moveToResult.undoOperations);
|
undoOperations.push(...moveToResult.undoOperations);
|
||||||
const newSourceParentElement = moveToResult.newSourceElements;
|
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) {
|
if (isBottom) {
|
||||||
// 拖拽到超级块 col 下方, 其他块右侧
|
// 拖拽到超级块 col 下方, 其他块右侧
|
||||||
sbElement.insertAdjacentElement("afterbegin", targetElement);
|
sbElement.insertAdjacentElement("afterbegin", targetElement);
|
||||||
doOperations.push({
|
doOperations.splice(removeIndex, 0, {
|
||||||
action: "move",
|
action: "move",
|
||||||
id: targetElement.getAttribute("data-node-id"),
|
id: targetElement.getAttribute("data-node-id"),
|
||||||
parentID: sbElement.getAttribute("data-node-id")
|
parentID: sbElement.getAttribute("data-node-id")
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
sbElement.lastElementChild.insertAdjacentElement("beforebegin", targetElement);
|
sbElement.lastElementChild.insertAdjacentElement("beforebegin", targetElement);
|
||||||
doOperations.push({
|
doOperations.splice(removeIndex, 0, {
|
||||||
action: "move",
|
action: "move",
|
||||||
id: targetElement.getAttribute("data-node-id"),
|
id: targetElement.getAttribute("data-node-id"),
|
||||||
previousID: newSourceParentElement[0].getAttribute("data-node-id"),
|
previousID: newSourceParentElement[0].getAttribute("data-node-id"),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue