mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-28 11:16:09 +01:00
This commit is contained in:
parent
cde0840bf7
commit
c596823aeb
1 changed files with 13 additions and 15 deletions
|
|
@ -565,21 +565,19 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,
|
|||
blockElement.getAttribute("fold") === "1" && !insertBefore) {
|
||||
fetchPost("/api/block/getHeadingChildrenIDs", {id: blockElement.getAttribute("data-node-id")}, (response) => {
|
||||
const childrenIDs: string[] = response.data;
|
||||
if (childrenIDs.length > 0) {
|
||||
const previousId = childrenIDs[childrenIDs.length - 1];
|
||||
foldData = setFold(protyle, blockElement, true, false, false, true);
|
||||
foldData.doOperations[0].context = {
|
||||
focusId: lastElement?.getAttribute("data-node-id"),
|
||||
};
|
||||
doOperation.forEach(item => {
|
||||
if (item.action === "insert") {
|
||||
item.previousID = previousId;
|
||||
}
|
||||
});
|
||||
doOperation.splice(0, 0, ...foldData.doOperations);
|
||||
undoOperation.push(...foldData.undoOperations);
|
||||
transaction(protyle, doOperation, undoOperation);
|
||||
}
|
||||
const previousId = (childrenIDs && childrenIDs.length > 0) ? childrenIDs[childrenIDs.length - 1] : blockElement.getAttribute("data-node-id");
|
||||
foldData = setFold(protyle, blockElement, true, false, false, true);
|
||||
foldData.doOperations[0].context = {
|
||||
focusId: lastElement?.getAttribute("data-node-id"),
|
||||
};
|
||||
doOperation.forEach(item => {
|
||||
if (item.action === "insert") {
|
||||
item.previousID = previousId;
|
||||
}
|
||||
});
|
||||
doOperation.splice(0, 0, ...foldData.doOperations);
|
||||
undoOperation.push(...foldData.undoOperations);
|
||||
transaction(protyle, doOperation, undoOperation);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue