This commit is contained in:
Vanessa 2023-09-08 23:06:36 +08:00
parent b0453dfaba
commit 18eca7f8d3

View file

@ -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);
}