Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/10696

Vanessa50b97c084402
diff --git a/app/src/protyle/wysiwyg/enter.ts b/app/src/protyle/wysiwyg/enter.ts
index 3ad5c8bb44..bd960a513e 100644
--- a/app/src/protyle/wysiwyg/enter.ts
+++ b/app/src/protyle/wysiwyg/enter.ts
@@ -7,7 +7,7 @@ import {
hasPreviousSibling,
isNotEditBlock
} from "./getBlock";
-import {transaction, updateTransaction} from "./transaction";
+import {transaction, turnsIntoOneTransaction, updateTransaction} from "./transaction";
import {breakList, genListItemElement, listOutdent, updateListOrder} from "./list";
import {highlightRender} from "../render/highlightRender";
import {Constants} from "../../constants";
@@ -249,6 +249,7 @@ export const enter = (blockElement: HTMLElement, range: Range, protyle: IProtyle
const undoOperation: IOperation[] = [];
let currentElement = blockElement;
// 回车之前的块为 1\n\n2 时会产生多个块
+ const selectsElement: Element[] = []
Array.from(enterElement.children).forEach((item: HTMLElement) => {
if (item.dataset.nodeId === id) {
blockElement.before(item);
@@ -278,6 +279,7 @@ export const enter = (blockElement: HTMLElement, range: Range, protyle: IProtyle
}
mathRender(item);
currentElement = item;
+ selectsElement.push(item);
});
Array.from(newElement.children).forEach((item: HTMLElement) => {
@@ -299,8 +301,18 @@ export const enter = (blockElement: HTMLElement, range: Range, protyle: IProtyle
mathRender(currentElement.nextElementSibling);
}
currentElement = item;
+ selectsElement.push(item);
});
+ const parentElement = currentElement.parentElement
transaction(protyle, doOperation, undoOperation);
+ if (parentElement.classList.contains("sb") && parentElement.getAttribute("data-sb-layout") === "col") {
+ turnsIntoOneTransaction({
+ protyle,
+ selectsElement,
+ type: "BlocksMergeSuperBlock",
+ level: "row"
+ });
+ }
focusBlock(currentElement);
scrollCenter(protyle);
return true;