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/15179 拖拽时的浮层变形

Vanessa02e5e1a595c2
diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts
index f57a893a6f..4e6679da8b 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"));