mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 00:50:13 +01:00
This commit is contained in:
parent
9aadfe3041
commit
9cbcaf237a
1 changed files with 16 additions and 4 deletions
|
|
@ -168,7 +168,7 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false) =>
|
|||
}
|
||||
let lastElement: Element;
|
||||
Array.from(tempElement.content.children).reverse().forEach((item) => {
|
||||
const addId = item.getAttribute("data-node-id");
|
||||
let addId = item.getAttribute("data-node-id");
|
||||
if (addId === id) {
|
||||
doOperation.push({
|
||||
action: "update",
|
||||
|
|
@ -181,6 +181,18 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false) =>
|
|||
data: oldHTML,
|
||||
});
|
||||
} else {
|
||||
if (item.classList.contains("li") && !blockElement.parentElement.classList.contains("list")) {
|
||||
// https://github.com/siyuan-note/siyuan/issues/6534
|
||||
addId = Lute.NewNodeID()
|
||||
const liElement = document.createElement("div");
|
||||
liElement.setAttribute("data-subtype", item.getAttribute("data-subtype"));
|
||||
liElement.setAttribute("data-node-id", addId);
|
||||
liElement.setAttribute("data-type", "NodeList");
|
||||
liElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
||||
liElement.classList.add("list");
|
||||
liElement.append(item);
|
||||
item = liElement;
|
||||
}
|
||||
doOperation.push({
|
||||
action: "insert",
|
||||
data: item.outerHTML,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue