diff --git a/app/src/block/util.ts b/app/src/block/util.ts index d55a82eb1..47fafe992 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 b0d2a2e38..47de6f7cf 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 {