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/17800

Vanessabc9d8b526a17
diff --git a/app/src/protyle/wysiwyg/getBlock.ts b/app/src/protyle/wysiwyg/getBlock.ts
index 96ca39d461..a1530f375a 100644
--- a/app/src/protyle/wysiwyg/getBlock.ts
+++ b/app/src/protyle/wysiwyg/getBlock.ts
@@ -2,7 +2,8 @@ import {hasClosestBlock, isInEmbedBlock} from "../util/hasClosest";
import {Constants} from "../../constants";
export const getParentBlock = (element: Element) => {
- if (element.parentElement.classList.contains("callout-content")) {
+ if (element.parentElement.classList.contains("callout-content") ||
+ element.parentElement.classList.contains("protyle-wysiwyg__embed")) {
return element.parentElement.parentElement;
}
return element.parentElement;
diff --git a/app/src/protyle/wysiwyg/remove.ts b/app/src/protyle/wysiwyg/remove.ts
index 6700725fe4..67f44281c9 100644
--- a/app/src/protyle/wysiwyg/remove.ts
+++ b/app/src/protyle/wysiwyg/remove.ts
@@ -34,9 +34,6 @@ import {onGet} from "../util/onGet";
import {setFold} from "../util/blockFold";
export const removeBlock = async (protyle: IProtyle, blockElement: Element, range: Range, type: "Delete" | "Backspace" | "remove") => {
- if (isInEmbedBlock(blockElement)) {
- return;
- }
protyle.observerLoad?.disconnect();
// 删除后,防止滚动条滚动后调用 get 请求,因为返回的请求已查找不到内容块了
preventScroll(protyle);
@@ -73,6 +70,9 @@ export const removeBlock = async (protyle: IProtyle, blockElement: Element, rang
const item = selectElements[i];
const topElement = getTopAloneElement(item);
topParentElement = topElement.parentElement;
+ if (isInEmbedBlock(item)) {
+ continue;
+ }
const id = topElement.getAttribute("data-node-id");
deletes.push({
action: "delete",
@@ -278,6 +278,9 @@ export const removeBlock = async (protyle: IProtyle, blockElement: Element, rang
}, Constants.TIMEOUT_COUNT);// 需等待滚动阻塞、后台处理完成。否则会加载已删除的内容
return;
}
+ if (isInEmbedBlock(blockElement)) {
+ return;
+ }
const blockType = blockElement.getAttribute("data-type");
// 空代码块直接删除
if (blockType === "NodeCodeBlock" && getContenteditableElement(blockElement)?.textContent.trim() === "") {