Vanessa 2024-12-25 21:16:40 +08:00
parent c24c0d6af7
commit b4eb694888
2 changed files with 6 additions and 4 deletions

View file

@ -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", () => {

View file

@ -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;
}
}