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

Vanessab4eb6948885f
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index f4e531d816..2f95aa57fc 100644
--- a/app/src/protyle/gutter/index.ts
+++ b/app/src/protyle/gutter/index.ts
@@ -148,7 +148,7 @@ export class Gutter {
buttonElement.style.opacity = "0.1";
window.siyuan.dragElement = avElement as HTMLElement || protyle.wysiwyg.element;
- event.dataTransfer.setData(`${Constants.SIYUAN_DROP_GUTTER}${buttonElement.getAttribute("data-type")}${Constants.ZWSP}${buttonElement.getAttribute("data-subtype")}${Constants.ZWSP}${selectIds}`,
+ event.dataTransfer.setData(`${Constants.SIYUAN_DROP_GUTTER}${buttonElement.getAttribute("data-type")}${Constants.ZWSP}${buttonElement.getAttribute("data-subtype")}${Constants.ZWSP}${selectIds}${Constants.ZWSP}${window.siyuan.config.system.workspaceDir}`,
protyle.wysiwyg.element.innerHTML);
});
this.element.addEventListener("dragend", () => {
diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts
index a4a7126907..42a1d8f19c 100644
--- a/app/src/protyle/util/editorCommonEvent.ts
+++ b/app/src/protyle/util/editorCommonEvent.ts
@@ -895,7 +895,9 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
sourceElements.push(elementItem);
}
});
- } else { // 跨窗口拖拽
+ } else if (window.siyuan.config.system.workspaceDir.toLowerCase() === gutterTypes[3]) {
+ // 跨窗口拖拽
+ // 不能跨工作区域拖拽 https://github.com/siyuan-note/siyuan/issues/13582
const targetProtyleElement = document.createElement("template");
targetProtyleElement.innerHTML = `<div>${event.dataTransfer.getData(gutterType)}</div>`;
targetProtyleElement.content.querySelectorAll(queryClass.substring(0, queryClass.length - 1)).forEach(elementItem => {
@@ -975,7 +977,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
} else if (targetElement.classList.contains("av__row")) {
// 拖拽到属性视图内
const blockElement = hasClosestBlock(targetElement);
- if (blockElement) {
+ if (blockElement && sourceElements.length > 0) {
let previousID = "";
if (targetClass.includes("dragover__bottom")) {
previousID = targetElement.getAttribute("data-id") || "";
@@ -1346,7 +1348,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
} else if (targetElement && gutterType && gutterType.startsWith(`${Constants.SIYUAN_DROP_GUTTER}NodeAttributeViewRowMenu${Constants.ZWSP}`.toLowerCase())) {
// 行只能拖拽当前 av 中
if ((!targetElement.classList.contains("av__row") && !targetElement.classList.contains("av__row--util")) ||
- !window.siyuan.dragElement.contains(targetElement)) {
+ (window.siyuan.dragElement && !window.siyuan.dragElement.contains(targetElement))) {
targetElement = false;
}
}