mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-02 14:58:49 +01:00
This commit is contained in:
parent
f4aaa6c0c0
commit
e48c57c8b8
2 changed files with 5 additions and 4 deletions
|
|
@ -100,7 +100,7 @@ export const isNotEditBlock = (element: Element) => {
|
|||
export const getTopEmptyElement = (element: Element) => {
|
||||
let topElement = element;
|
||||
while (topElement.parentElement && !topElement.parentElement.classList.contains("protyle-wysiwyg")) {
|
||||
if (!topElement.parentElement.getAttribute("data-node-id")) {
|
||||
if (!topElement.parentElement.getAttribute("data-node-id") && !topElement.parentElement.classList.contains("callout-content")) {
|
||||
topElement = topElement.parentElement;
|
||||
} else {
|
||||
let hasText = false;
|
||||
|
|
|
|||
|
|
@ -233,13 +233,14 @@ export const removeBlock = async (protyle: IProtyle, blockElement: Element, rang
|
|||
return;
|
||||
}
|
||||
|
||||
if (!blockElement.previousElementSibling && blockElement.parentElement.getAttribute("data-type") === "NodeBlockquote") {
|
||||
const isCallout = blockElement.parentElement.classList.contains("callout-content");
|
||||
if (!blockElement.previousElementSibling && (blockElement.parentElement.getAttribute("data-type") === "NodeBlockquote" || isCallout)) {
|
||||
if (type !== "Delete") {
|
||||
range.insertNode(document.createElement("wbr"));
|
||||
}
|
||||
const blockParentElement = blockElement.parentElement;
|
||||
const blockParentElement = isCallout ? blockElement.parentElement.parentElement : blockElement.parentElement;
|
||||
blockParentElement.insertAdjacentElement("beforebegin", blockElement);
|
||||
if (blockParentElement.childElementCount === 1) {
|
||||
if (isCallout ? blockParentElement.querySelector(".callout-content").childElementCount === 0:blockParentElement.childElementCount === 1 ) {
|
||||
transaction(protyle, [{
|
||||
action: "move",
|
||||
id: blockElement.getAttribute("data-node-id"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue