Skip to content

Commit 863bd7d

Browse files
committed
🎨 #15186
1 parent 96d32d7 commit 863bd7d

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

app/src/assets/scss/business/_av.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@
345345
object-fit: cover;
346346
width: 100%;
347347
object-position: center;
348+
pointer-events: none;
348349

349350
&--fit {
350351
object-fit: contain;

app/src/protyle/util/editorCommonEvent.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -850,12 +850,16 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
850850
} else if (target.classList.contains("av__gallery-item")) {
851851
const blockElement = hasClosestBlock(target);
852852
if (blockElement) {
853+
target.classList.add("av__gallery-item--select");
853854
const ghostElement = document.createElement("div");
854-
ghostElement.className = "protyle-wysiwyg protyle-wysiwyg--attr";
855-
ghostElement.append(processClonePHElement(target.cloneNode(true) as Element));
856-
ghostElement.setAttribute("style", `position:fixed;opacity:.1;padding:0;
857-
width:${target.clientWidth}px;;height:${target.clientHeight}px;`);
858-
ghostElement.querySelector(".av__gallery-fields").setAttribute("style", "background-color: var(--b3-theme-background)");
855+
ghostElement.className = "protyle-wysiwyg protyle-wysiwyg--attr " + target.parentElement.className;
856+
blockElement.querySelectorAll(".av__gallery-item--select").forEach(item => {
857+
const cloneItem = processClonePHElement(item.cloneNode(true) as Element);
858+
cloneItem.setAttribute("style", `width:${item.clientWidth}px;;height:${item.clientHeight}px;`);
859+
cloneItem.querySelector(".av__gallery-fields").setAttribute("style", "background-color: var(--b3-theme-background)");
860+
ghostElement.append(cloneItem);
861+
});
862+
ghostElement.setAttribute("style", "position:fixed;opacity:.1;padding:0;z-index:1;");
859863
document.body.append(ghostElement);
860864
event.dataTransfer.setDragImage(ghostElement, -10, -10);
861865
setTimeout(() => {
@@ -870,7 +874,7 @@ width:${target.clientWidth}px;;height:${target.clientHeight}px;`);
870874
selectIds.push(target.getAttribute("data-id"));
871875
}
872876
event.dataTransfer.setData(`${Constants.SIYUAN_DROP_GUTTER}NodeAttributeView${Constants.ZWSP}GalleryItem${Constants.ZWSP}${selectIds}`,
873-
target.outerHTML);
877+
ghostElement.outerHTML);
874878
}
875879
return;
876880
}

0 commit comments

Comments
 (0)