This commit is contained in:
Vanessa 2022-10-25 11:01:01 +08:00
parent 5fa73eedf1
commit f4c3be9bd0

View file

@ -96,12 +96,14 @@ export const getTopEmptyElement = (element: Element) => {
if (!topElement.parentElement.getAttribute("data-node-id")) {
topElement = topElement.parentElement;
} else {
const hasText = Array.from(topElement.parentElement.querySelectorAll('[contenteditable="true"]')).find(item => {
let hasText = false
Array.from(topElement.parentElement.querySelectorAll('[contenteditable="true"]')).find(item => {
if (item.textContent.replace(Constants.ZWSP, "").replace("\n", "") !== "") {
hasText = true;
return true;
}
});
if (!hasText || topElement.previousElementSibling?.getAttribute("data-node-id") ||
if (hasText || topElement.previousElementSibling?.getAttribute("data-node-id") ||
topElement.nextElementSibling?.getAttribute("data-node-id")) {
break;
} else {