mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 15:40:12 +01:00
This commit is contained in:
parent
5fa73eedf1
commit
f4c3be9bd0
1 changed files with 4 additions and 2 deletions
|
|
@ -96,12 +96,14 @@ export const getTopEmptyElement = (element: Element) => {
|
||||||
if (!topElement.parentElement.getAttribute("data-node-id")) {
|
if (!topElement.parentElement.getAttribute("data-node-id")) {
|
||||||
topElement = topElement.parentElement;
|
topElement = topElement.parentElement;
|
||||||
} else {
|
} 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", "") !== "") {
|
if (item.textContent.replace(Constants.ZWSP, "").replace("\n", "") !== "") {
|
||||||
|
hasText = true;
|
||||||
return 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")) {
|
topElement.nextElementSibling?.getAttribute("data-node-id")) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue