From 02e5e1a595c27e48ef03498ca3b8b75dece28b13 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 30 Jun 2025 12:39:38 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20https://github.com/siyuan-note/siyuan/i?= =?UTF-8?q?ssues/15179=20=E6=8B=96=E6=8B=BD=E6=97=B6=E7=9A=84=E6=B5=AE?= =?UTF-8?q?=E5=B1=82=E5=8F=98=E5=BD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/protyle/util/editorCommonEvent.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts index f57a893a6..4e6679da8 100644 --- a/app/src/protyle/util/editorCommonEvent.ts +++ b/app/src/protyle/util/editorCommonEvent.ts @@ -848,9 +848,20 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => { target.outerHTML); return; } else if (target.classList.contains("av__gallery-item")) { - window.siyuan.dragElement = target; const blockElement = hasClosestBlock(target); if (blockElement) { + const ghostElement = document.createElement("div"); + ghostElement.className = 'protyle-wysiwyg protyle-wysiwyg--attr'; + ghostElement.append(processClonePHElement(target.cloneNode(true) as Element)); + ghostElement.setAttribute("style", `position:fixed;opacity:.1;padding:0; +width:${target.clientWidth}px;;height:${target.clientHeight}px;`); + ghostElement.querySelector(".av__gallery-fields").setAttribute("style", "background-color: var(--b3-theme-background)"); + document.body.append(ghostElement); + event.dataTransfer.setDragImage(ghostElement, -10, -10); + setTimeout(() => { + ghostElement.remove(); + }); + window.siyuan.dragElement = target; const selectIds: string[] = []; blockElement.querySelectorAll(".av__gallery-item--select").forEach(item => { selectIds.push(item.getAttribute("data-id"));