Vanessa 2022-10-04 11:43:45 +08:00
parent 6afce77b1d
commit 0e2971c43f
2 changed files with 3 additions and 4 deletions

View file

@ -65,7 +65,6 @@ export class Gutter {
window.siyuan.dragElement = undefined;
}
});
// TODO:fold
this.element.addEventListener("click", (event: MouseEvent & { target: HTMLInputElement }) => {
const buttonElement = hasClosestByTag(event.target, "BUTTON");
if (!buttonElement) {
@ -1454,7 +1453,6 @@ export class Gutter {
});
}
});
// TODO 字体大小
return styles;
}

View file

@ -220,6 +220,7 @@ const promiseTransaction = () => {
if (operation.previousID) {
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.previousID}"]`)).forEach(item => {
if (item.nextElementSibling?.getAttribute("data-node-id") !== operation.id &&
!hasClosestByAttribute(item, "data-node-id", operation.id) && // 段落转列表会在段落后插入新列表
(item.getAttribute("data-type") === "NodeBlockQueryEmbed" || !hasClosestByAttribute(item.parentElement, "data-type", "NodeBlockQueryEmbed"))) {
item.insertAdjacentHTML("afterend", operation.data);
cursorElements.push(item.nextElementSibling);
@ -643,7 +644,7 @@ export const turnsIntoOneTransaction = (options: { protyle: IProtyle, selectsEle
});
parentElement.innerHTML = html + '<div class="protyle-attr" contenteditable="false"></div>';
}
const previousId = options.selectsElement[0].previousElementSibling ? options.selectsElement[0].previousElementSibling.getAttribute("data-node-id") : undefined;
const previousId = options.selectsElement[0].getAttribute("data-node-id");
const parentId = options.selectsElement[0].parentElement.getAttribute("data-node-id") || options.protyle.block.parentID;
const doOperations: IOperation[] = [{
action: "insert",
@ -665,7 +666,7 @@ export const turnsIntoOneTransaction = (options: { protyle: IProtyle, selectsEle
undoOperations.push({
action: "move",
id: itemId,
previousID: itemPreviousId || previousId,
previousID: itemPreviousId || id,
parentID: parentId
});
if (options.type.endsWith("Ls")) {