mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
This commit is contained in:
parent
a5c2053218
commit
16aaf9a1ca
1 changed files with 14 additions and 2 deletions
|
|
@ -1065,7 +1065,7 @@ export const turnsIntoTransaction = (options: {
|
||||||
const doOperations: IOperation[] = [];
|
const doOperations: IOperation[] = [];
|
||||||
const undoOperations: IOperation[] = [];
|
const undoOperations: IOperation[] = [];
|
||||||
let previousId: string;
|
let previousId: string;
|
||||||
selectsElement.forEach((item, index) => {
|
selectsElement.forEach((item: HTMLElement, index) => {
|
||||||
item.classList.remove("protyle-wysiwyg--select");
|
item.classList.remove("protyle-wysiwyg--select");
|
||||||
item.removeAttribute("select-start");
|
item.removeAttribute("select-start");
|
||||||
item.removeAttribute("select-end");
|
item.removeAttribute("select-end");
|
||||||
|
|
@ -1075,7 +1075,7 @@ export const turnsIntoTransaction = (options: {
|
||||||
const tempElement = document.createElement("template");
|
const tempElement = document.createElement("template");
|
||||||
if (!options.isContinue) {
|
if (!options.isContinue) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const newHTML = options.protyle.lute[options.type](item.outerHTML, options.level);
|
let newHTML = options.protyle.lute[options.type](item.outerHTML, options.level);
|
||||||
tempElement.innerHTML = newHTML;
|
tempElement.innerHTML = newHTML;
|
||||||
|
|
||||||
if (!tempElement.content.querySelector(`[data-node-id="${id}"]`)) {
|
if (!tempElement.content.querySelector(`[data-node-id="${id}"]`)) {
|
||||||
|
|
@ -1110,6 +1110,15 @@ export const turnsIntoTransaction = (options: {
|
||||||
previousId = undefined;
|
previousId = undefined;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
let foldData;
|
||||||
|
if (item.getAttribute("data-type") === "NodeHeading" && item.getAttribute("fold") === "1" &&
|
||||||
|
tempElement.content.firstElementChild.getAttribute("data-subtype") !== item.dataset.subtype) {
|
||||||
|
foldData = setFold(options.protyle, item, undefined, undefined, false, true);
|
||||||
|
newHTML = newHTML.replace(' fold="1"', "");
|
||||||
|
}
|
||||||
|
if (foldData && foldData.doOperations?.length > 0) {
|
||||||
|
doOperations.push(...foldData.doOperations);
|
||||||
|
}
|
||||||
undoOperations.push({
|
undoOperations.push({
|
||||||
action: "update",
|
action: "update",
|
||||||
id,
|
id,
|
||||||
|
|
@ -1120,6 +1129,9 @@ export const turnsIntoTransaction = (options: {
|
||||||
id,
|
id,
|
||||||
data: newHTML
|
data: newHTML
|
||||||
});
|
});
|
||||||
|
if (foldData && foldData.undoOperations?.length > 0) {
|
||||||
|
undoOperations.push(...foldData.undoOperations);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
item.outerHTML = newHTML;
|
item.outerHTML = newHTML;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue