Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/16051

Vanessae48c57c8b88e
diff --git a/app/src/protyle/wysiwyg/getBlock.ts b/app/src/protyle/wysiwyg/getBlock.ts
index 1420dacc89..4976f1e1ac 100644
--- a/app/src/protyle/wysiwyg/getBlock.ts
+++ b/app/src/protyle/wysiwyg/getBlock.ts
@@ -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;
diff --git a/app/src/protyle/wysiwyg/remove.ts b/app/src/protyle/wysiwyg/remove.ts
index c6ffcde53c..28900f91b7 100644
--- a/app/src/protyle/wysiwyg/remove.ts
+++ b/app/src/protyle/wysiwyg/remove.ts
@@ -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"),