Skip to content

Commit eb7066f

Browse files
committed
🎨 #15570
1 parent 3dcda6b commit eb7066f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

app/src/protyle/util/editorCommonEvent.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,12 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
868868
event.stopPropagation();
869869
return;
870870
}
871-
target.classList.add("av__gallery-item--select");
871+
if (!target.classList.contains("av__gallery-item--select")) {
872+
blockElement.querySelectorAll(".av__gallery-item--select").forEach(item => {
873+
item.classList.remove("av__gallery-item--select");
874+
})
875+
target.classList.add("av__gallery-item--select");
876+
}
872877
const ghostElement = document.createElement("div");
873878
ghostElement.className = "protyle-wysiwyg protyle-wysiwyg--attr";
874879
const selectElements = blockElement.querySelectorAll(".av__gallery-item--select");
@@ -900,11 +905,6 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
900905
const groupId = bodyElement.getAttribute("data-group-id");
901906
selectIds.push(item.getAttribute("data-id") + (groupId ? `@${groupId}` : ""));
902907
});
903-
if (selectIds.length === 0) {
904-
const bodyElement = hasClosestByClassName(target, "av__body") as HTMLElement;
905-
const groupId = bodyElement.getAttribute("data-group-id");
906-
selectIds.push(target.getAttribute("data-id") + (groupId ? `@${groupId}` : ""));
907-
}
908908
event.dataTransfer.setData(`${Constants.SIYUAN_DROP_GUTTER}NodeAttributeView${Constants.ZWSP}GalleryItem${Constants.ZWSP}${selectIds}`,
909909
ghostElement.outerHTML);
910910
}

0 commit comments

Comments
 (0)