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

Vanessa14424d3dc045
diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.ts
index dac6483d28..336e0803af 100644
--- a/app/src/protyle/hint/extend.ts
+++ b/app/src/protyle/hint/extend.ts
@@ -434,12 +434,21 @@ export const hintRenderAssets = (value: string, protyle: IProtyle) => {
};
export const hintMoveBlock = (pathString: string, sourceElements: Element[], protyle: IProtyle) => {
+ if (pathString === "/") {
+ return;
+ }
+ const parentID = getDisplayName(pathString, true, true)
+ if (protyle.block.rootID === parentID) {
+ return;
+ }
const doOperations: IOperation[] = [];
let topSourceElement: Element;
const parentElement = sourceElements[0].parentElement;
let sideElement;
sourceElements.forEach((item, index) => {
- if (index === sourceElements.length - 1) {
+ if (index === sourceElements.length - 1 &&
+ // 动态加载过慢,导致 item 被移除
+ item.parentElement) {
topSourceElement = getTopAloneElement(item);
sideElement = topSourceElement.nextElementSibling || topSourceElement.previousElementSibling;
if (topSourceElement.isSameNode(item)) {
@@ -449,7 +458,7 @@ export const hintMoveBlock = (pathString: string, sourceElements: Element[], pro
doOperations.push({
action: "append",
id: item.getAttribute("data-node-id"),
- parentID: getDisplayName(pathString, true, true)
+ parentID,
});
item.remove();
});
@@ -494,8 +503,6 @@ export const hintMoveBlock = (pathString: string, sourceElements: Element[], pro
} else if (sideElement) {
focusBlock(sideElement);
}
-
// 跨文档不支持撤销
transaction(protyle, doOperations);
- hideElements(["util"], protyle);
};