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/14720

Vanessa7dd7a0701895
diff --git a/app/src/block/util.ts b/app/src/block/util.ts
index d55a82eb1a..47fafe9929 100644
--- a/app/src/block/util.ts
+++ b/app/src/block/util.ts
@@ -1,5 +1,5 @@
import {focusByWbr, getEditorRange} from "../protyle/util/selection";
-import {hasClosestBlock} from "../protyle/util/hasClosest";
+import {hasClosestBlock, hasClosestByClassName} from "../protyle/util/hasClosest";
import {getContenteditableElement, getTopAloneElement} from "../protyle/wysiwyg/getBlock";
import {genListItemElement, updateListOrder} from "../protyle/wysiwyg/list";
import {transaction, turnsIntoOneTransaction, updateTransaction} from "../protyle/wysiwyg/transaction";
@@ -131,6 +131,12 @@ export const insertEmptyBlock = (protyle: IProtyle, position: InsertPosition, id
} else {
blockElement = hasClosestBlock(range.startContainer) as HTMLElement;
blockElement = getTopAloneElement(blockElement);
+ // https://github.com/siyuan-note/siyuan/issues/14720#issuecomment-2840665326
+ if (blockElement.classList.contains("list")) {
+ blockElement = hasClosestByClassName(range.startContainer, "li") as HTMLElement;
+ } else if (blockElement.classList.contains("bq")) {
+ blockElement = hasClosestBlock(range.startContainer) as HTMLElement;
+ }
}
}
if (!blockElement) {
diff --git a/app/src/protyle/wysiwyg/enter.ts b/app/src/protyle/wysiwyg/enter.ts
index b0d2a2e383..47de6f7cf8 100644
--- a/app/src/protyle/wysiwyg/enter.ts
+++ b/app/src/protyle/wysiwyg/enter.ts
@@ -35,10 +35,6 @@ export const enter = (blockElement: HTMLElement, range: Range, protyle: IProtyle
if (disableElement ||
// https://github.com/siyuan-note/siyuan/issues/10633
blockElement.classList.contains("table")) {
- if (blockElement.classList.contains("hr")) {
- insertEmptyBlock(protyle, "afterend");
- return;
- }
if (blockElement.classList.contains("protyle-wysiwyg--select") && blockElement.classList.contains("render-node")) {
protyle.toolbar.showRender(protyle, blockElement);
} else {