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 doOperations: IOperation[] = [];
|
||||||
const undoOperations: IOperation[] = [];
|
const undoOperations: IOperation[] = [];
|
||||||
let starIndex: number;
|
let starIndex: number;
|
||||||
if (nodeElements[nodeElements.length - 1].classList.contains("li") &&
|
const lastElement = nodeElements[nodeElements.length - 1];
|
||||||
nodeElements[nodeElements.length - 1].getAttribute("data-subtype") === "o") {
|
if (lastElement.classList.contains("li") &&
|
||||||
starIndex = parseInt(nodeElements[nodeElements.length - 1].getAttribute("data-marker"), 10);
|
lastElement.getAttribute("data-subtype") === "o") {
|
||||||
|
starIndex = parseInt(lastElement.getAttribute("data-marker"), 10);
|
||||||
}
|
}
|
||||||
const foldHeadingIds = [];
|
const foldHeadingIds = [];
|
||||||
for (let index = nodeElements.length - 1; index >= 0; --index) {
|
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.setAttribute("data-marker", (orderIndex) + ".");
|
||||||
tempElement.querySelector(".protyle-action--order").textContent = (orderIndex) + ".";
|
tempElement.querySelector(".protyle-action--order").textContent = (orderIndex) + ".";
|
||||||
}
|
}
|
||||||
nodeElements[0].after(processClonePHElement(tempElement));
|
lastElement.after(processClonePHElement(tempElement));
|
||||||
doOperations.push({
|
doOperations.push({
|
||||||
action: "insert",
|
action: "insert",
|
||||||
data: tempElement.outerHTML,
|
data: tempElement.outerHTML,
|
||||||
id: newId,
|
id: newId,
|
||||||
previousID: nodeElements[0].getAttribute("data-node-id"),
|
previousID: lastElement.getAttribute("data-node-id"),
|
||||||
});
|
});
|
||||||
undoOperations.push({
|
undoOperations.push({
|
||||||
action: "delete",
|
action: "delete",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue