Vanessa 2025-07-29 11:01:18 +08:00
parent fa2ec80cb1
commit f91e87b953
2 changed files with 15 additions and 6 deletions

View file

@ -5,7 +5,6 @@ import {setPosition} from "../../../util/setPosition";
import {getFieldsByData} from "./view";
import {fetchSyncPost} from "../../../util/fetch";
import {Menu} from "../../../plugin/Menu";
import {transaction} from "../../wysiwyg/transaction";
import {objEquals} from "../../../util/functions";
export const setGroupMethod = async (options: {

View file

@ -870,14 +870,24 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
}
target.classList.add("av__gallery-item--select");
const ghostElement = document.createElement("div");
ghostElement.className = "protyle-wysiwyg protyle-wysiwyg--attr " + target.parentElement.className;
blockElement.querySelectorAll(".av__gallery-item--select").forEach(item => {
ghostElement.className = "protyle-wysiwyg protyle-wysiwyg--attr";
const selectElements = blockElement.querySelectorAll(".av__gallery-item--select");
let galleryElement: HTMLElement;
let cloneGalleryElement = document.createElement("div");
selectElements.forEach(item => {
if (!galleryElement || !galleryElement.contains(item)) {
galleryElement = item.parentElement;
cloneGalleryElement = document.createElement("div");
cloneGalleryElement.classList.add("av__gallery");
cloneGalleryElement.setAttribute("style", `width: 100vw;margin-bottom: 16px;grid-template-columns: repeat(auto-fill, ${selectElements[0].clientWidth}px);`);
ghostElement.appendChild(cloneGalleryElement);
}
const cloneItem = processClonePHElement(item.cloneNode(true) as Element);
cloneItem.setAttribute("style", `width:${item.clientWidth}px;;height:${item.clientHeight}px;`);
cloneItem.setAttribute("style", `height:${item.clientHeight}px;`);
cloneItem.querySelector(".av__gallery-fields").setAttribute("style", "background-color: var(--b3-theme-background)");
ghostElement.append(cloneItem);
cloneGalleryElement.appendChild(cloneItem);
});
ghostElement.setAttribute("style", "top:100vh;position:fixed;opacity:.1;padding:0");
ghostElement.setAttribute("style", "top:100vh;position:fixed;opacity:.1;padding:0;z-index: 8");
document.body.append(ghostElement);
event.dataTransfer.setDragImage(ghostElement, -10, -10);
setTimeout(() => {