mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
This commit is contained in:
parent
e551cb4a4c
commit
c0699721ac
1 changed files with 6 additions and 3 deletions
|
|
@ -52,6 +52,7 @@ export const removeBlock = async (protyle: IProtyle, blockElement: Element, rang
|
||||||
let listElement: Element;
|
let listElement: Element;
|
||||||
let topParentElement: Element;
|
let topParentElement: Element;
|
||||||
hideElements(["select"], protyle);
|
hideElements(["select"], protyle);
|
||||||
|
const unfoldOperations = [];
|
||||||
for (let i = 0; i < selectElements.length; i++) {
|
for (let i = 0; i < selectElements.length; i++) {
|
||||||
const item = selectElements[i];
|
const item = selectElements[i];
|
||||||
const topElement = getTopAloneElement(item);
|
const topElement = getTopAloneElement(item);
|
||||||
|
|
@ -108,9 +109,7 @@ export const removeBlock = async (protyle: IProtyle, blockElement: Element, rang
|
||||||
(topElement.nextElementSibling.getAttribute("data-type") !== "NodeHeading" ||
|
(topElement.nextElementSibling.getAttribute("data-type") !== "NodeHeading" ||
|
||||||
(topElement.nextElementSibling.getAttribute("data-type") === "NodeHeading" && topElement.nextElementSibling.getAttribute("data-subtype") < topElement.getAttribute("data-subtype"))
|
(topElement.nextElementSibling.getAttribute("data-type") === "NodeHeading" && topElement.nextElementSibling.getAttribute("data-subtype") < topElement.getAttribute("data-subtype"))
|
||||||
)) {
|
)) {
|
||||||
const unfoldOperations = setFold(protyle, topElement.previousElementSibling, true, false, false, true);
|
unfoldOperations.push(setFold(protyle, topElement.previousElementSibling, true, false, false, true));
|
||||||
deletes.push(...unfoldOperations.doOperations);
|
|
||||||
inserts.push(...unfoldOperations.undoOperations);
|
|
||||||
const foldTransaction = await fetchSyncPost("/api/block/getHeadingDeleteTransaction", {
|
const foldTransaction = await fetchSyncPost("/api/block/getHeadingDeleteTransaction", {
|
||||||
id: topElement.previousElementSibling.getAttribute("data-node-id"),
|
id: topElement.previousElementSibling.getAttribute("data-node-id"),
|
||||||
});
|
});
|
||||||
|
|
@ -131,6 +130,10 @@ export const removeBlock = async (protyle: IProtyle, blockElement: Element, rang
|
||||||
topElement.remove();
|
topElement.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unfoldOperations.forEach(item => {
|
||||||
|
deletes.push(...item.doOperations);
|
||||||
|
inserts.push(...item.undoOperations);
|
||||||
|
});
|
||||||
if (sideElement) {
|
if (sideElement) {
|
||||||
if (protyle.block.showAll && sideElement.classList.contains("protyle-wysiwyg") && protyle.wysiwyg.element.childElementCount === 0) {
|
if (protyle.block.showAll && sideElement.classList.contains("protyle-wysiwyg") && protyle.wysiwyg.element.childElementCount === 0) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue