mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
This commit is contained in:
parent
8d8f55e49a
commit
2c23d05c7c
1 changed files with 6 additions and 5 deletions
|
|
@ -258,9 +258,10 @@ export const duplicateBlock = async (nodeElements: Element[], protyle: IProtyle)
|
|||
const doOperations: IOperation[] = [];
|
||||
const undoOperations: IOperation[] = [];
|
||||
let starIndex: number;
|
||||
if (nodeElements[nodeElements.length - 1].classList.contains("li") &&
|
||||
nodeElements[nodeElements.length - 1].getAttribute("data-subtype") === "o") {
|
||||
starIndex = parseInt(nodeElements[nodeElements.length - 1].getAttribute("data-marker"), 10);
|
||||
const lastElement = nodeElements[nodeElements.length - 1];
|
||||
if (lastElement.classList.contains("li") &&
|
||||
lastElement.getAttribute("data-subtype") === "o") {
|
||||
starIndex = parseInt(lastElement.getAttribute("data-marker"), 10);
|
||||
}
|
||||
const foldHeadingIds = [];
|
||||
for (let index = nodeElements.length - 1; index >= 0; --index) {
|
||||
|
|
@ -299,12 +300,12 @@ export const duplicateBlock = async (nodeElements: Element[], protyle: IProtyle)
|
|||
tempElement.setAttribute("data-marker", (orderIndex) + ".");
|
||||
tempElement.querySelector(".protyle-action--order").textContent = (orderIndex) + ".";
|
||||
}
|
||||
nodeElements[0].after(processClonePHElement(tempElement));
|
||||
lastElement.after(processClonePHElement(tempElement));
|
||||
doOperations.push({
|
||||
action: "insert",
|
||||
data: tempElement.outerHTML,
|
||||
id: newId,
|
||||
previousID: nodeElements[0].getAttribute("data-node-id"),
|
||||
previousID: lastElement.getAttribute("data-node-id"),
|
||||
});
|
||||
undoOperations.push({
|
||||
action: "delete",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue