Skip to content

Commit

Permalink
🎨 #13582
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Dec 25, 2024
1 parent c24c0d6 commit b4eb694
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/src/protyle/gutter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
8 changes: 5 additions & 3 deletions app/src/protyle/util/editorCommonEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down Expand Up @@ -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") || "";
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit b4eb694

Please sign in to comment.