mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-07-03 14:09:06 +02:00
This commit is contained in:
@@ -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"),
|
||||
|
||||
Reference in New Issue
Block a user