mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-09 22:22:34 +01:00
This commit is contained in:
parent
91c1b00305
commit
86878ffcc4
3 changed files with 18 additions and 4 deletions
|
|
@ -181,7 +181,7 @@ export const removeBlock = async (protyle: IProtyle, blockElement: Element, rang
|
|||
}
|
||||
if (deletes.length > 0) {
|
||||
if (topParentElement && topParentElement.getAttribute("data-type") === "NodeSuperBlock" && topParentElement.childElementCount === 2) {
|
||||
const sbData = await cancelSB(protyle, topParentElement);
|
||||
const sbData = await cancelSB(protyle, topParentElement, range);
|
||||
transaction(protyle, deletes.concat(sbData.doOperations), sbData.undoOperations.concat(inserts.reverse()));
|
||||
} else {
|
||||
transaction(protyle, deletes, inserts.reverse());
|
||||
|
|
|
|||
|
|
@ -746,11 +746,19 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
|
|||
}
|
||||
});
|
||||
} else {
|
||||
const parentElement = Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.parentID}"]`));
|
||||
if (!protyle.options.backlinkData && operation.parentID === protyle.block.parentID) {
|
||||
protyle.wysiwyg.element.insertAdjacentHTML("afterbegin", operation.data);
|
||||
cursorElements.push(protyle.wysiwyg.element.firstElementChild);
|
||||
} else if (parentElement.length === 0 && protyle.options.backlinkData && isUndo && getSelection().rangeCount > 0) {
|
||||
// 反链面板删除超级块中的段落块后撤销
|
||||
const blockElement = hasClosestBlock(getSelection().getRangeAt(0).startContainer)
|
||||
if (blockElement) {
|
||||
blockElement.insertAdjacentHTML("beforebegin", operation.data);
|
||||
cursorElements.push(blockElement.previousElementSibling);
|
||||
}
|
||||
} else {
|
||||
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.parentID}"]`)).forEach(item => {
|
||||
parentElement.forEach(item => {
|
||||
if (!isInEmbedBlock(item)) {
|
||||
// 列表特殊处理
|
||||
if (item.firstElementChild?.classList.contains("protyle-action")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue