Skip to content

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

:bug: fix https://github.com/siyuan-note/siyuan/issues/9141

Vanessa18eca7f8d375
diff --git a/app/src/protyle/wysiwyg/remove.ts b/app/src/protyle/wysiwyg/remove.ts
index b50a531cf1..72532a3d06 100644
--- a/app/src/protyle/wysiwyg/remove.ts
+++ b/app/src/protyle/wysiwyg/remove.ts
@@ -241,7 +241,7 @@ export const removeBlock = (protyle: IProtyle, blockElement: Element, range: Ran
if (sideElement) {
if (protyle.block.showAll && sideElement.classList.contains("protyle-wysiwyg") && protyle.wysiwyg.element.childElementCount === 0) {
setTimeout(() => {
- zoomOut({protyle, id:protyle.block.parent2ID, focusId:protyle.block.parent2ID});
+ zoomOut({protyle, id: protyle.block.parent2ID, focusId: protyle.block.parent2ID});
}, Constants.TIMEOUT_INPUT * 2 + 100);
} else {
if ((sideElement.classList.contains("protyle-wysiwyg") && protyle.wysiwyg.element.childElementCount === 0)) {
@@ -385,7 +385,7 @@ export const removeBlock = (protyle: IProtyle, blockElement: Element, range: Ran
const parentElement = blockElement.parentElement;
const editableElement = getContenteditableElement(blockElement);
- const previousLastElement = getLastBlock(previousElement) as HTMLElement;
+ let previousLastElement = getLastBlock(previousElement) as HTMLElement;
const isSelectNode = previousLastElement && (previousLastElement.classList.contains("table") || previousLastElement.classList.contains("render-node") || previousLastElement.classList.contains("iframe") || previousLastElement.classList.contains("hr") || previousLastElement.classList.contains("code-block"));
const previousId = previousLastElement.getAttribute("data-node-id");
if (isSelectNode) {
@@ -412,7 +412,8 @@ export const removeBlock = (protyle: IProtyle, blockElement: Element, range: Ran
transaction(protyle, doOperations, undoOperations);
}
// toStart 参数不能为 false, 否则 https://github.com/siyuan-note/siyuan/issues/9141
- focusBlock(protyle.wysiwyg.element.querySelector(`[data-node-id="${previousId}"]`), undefined, true);
+ previousLastElement = protyle.wysiwyg.element.querySelector(`[data-node-id="${previousId}"]`)
+ focusBlock(previousLastElement, undefined, getContenteditableElement(previousLastElement).textContent === "\n");
} else {
focusBlock(previousLastElement, undefined, false);
}