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

Vanessaeb7066ff3e95
diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts
index b7c39db9f3..46c6ef14b3 100644
--- a/app/src/protyle/util/editorCommonEvent.ts
+++ b/app/src/protyle/util/editorCommonEvent.ts
@@ -868,7 +868,12 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
event.stopPropagation();
return;
}
- target.classList.add("av__gallery-item--select");
+ if (!target.classList.contains("av__gallery-item--select")) {
+ blockElement.querySelectorAll(".av__gallery-item--select").forEach(item => {
+ item.classList.remove("av__gallery-item--select");
+ })
+ target.classList.add("av__gallery-item--select");
+ }
const ghostElement = document.createElement("div");
ghostElement.className = "protyle-wysiwyg protyle-wysiwyg--attr";
const selectElements = blockElement.querySelectorAll(".av__gallery-item--select");
@@ -900,11 +905,6 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
const groupId = bodyElement.getAttribute("data-group-id");
selectIds.push(item.getAttribute("data-id") + (groupId ? `@${groupId}` : ""));
});
- if (selectIds.length === 0) {
- const bodyElement = hasClosestByClassName(target, "av__body") as HTMLElement;
- const groupId = bodyElement.getAttribute("data-group-id");
- selectIds.push(target.getAttribute("data-id") + (groupId ? `@${groupId}` : ""));
- }
event.dataTransfer.setData(`${Constants.SIYUAN_DROP_GUTTER}NodeAttributeView${Constants.ZWSP}GalleryItem${Constants.ZWSP}${selectIds}`,
ghostElement.outerHTML);
}