mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-27 10:46:09 +01:00
This commit is contained in:
parent
4170f50dc6
commit
19068b9d76
2 changed files with 2 additions and 14 deletions
|
|
@ -170,15 +170,3 @@ export const hasPreviousSibling = (element: Node) => {
|
|||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
export const hasPrevious = (element: Node) => {
|
||||
let previousSibling = element.previousSibling;
|
||||
while (previousSibling) {
|
||||
if (previousSibling.textContent === "") {
|
||||
previousSibling = previousSibling.previousSibling;
|
||||
} else {
|
||||
return previousSibling;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import {
|
|||
getLastBlock,
|
||||
getNextBlock,
|
||||
getPreviousBlock,
|
||||
getTopAloneElement, hasNextSibling, hasPrevious,
|
||||
getTopAloneElement, hasNextSibling, hasPreviousSibling,
|
||||
isNotEditBlock,
|
||||
} from "./getBlock";
|
||||
import {matchHotKey} from "../util/hotKey";
|
||||
|
|
@ -593,7 +593,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
const currentNode = range.startContainer.childNodes[range.startOffset - 1] as HTMLElement;
|
||||
if (position.start === 0 && (
|
||||
range.startOffset === 0 ||
|
||||
(currentNode && currentNode.nodeType === 3 && !hasPrevious(currentNode) && currentNode.textContent === "") // https://ld246.com/article/1649251218696
|
||||
(currentNode && currentNode.nodeType === 3 && !hasPreviousSibling(currentNode) && currentNode.textContent === "") // https://ld246.com/article/1649251218696
|
||||
)) {
|
||||
removeBlock(protyle, nodeElement, range);
|
||||
event.stopPropagation();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue