🎨 Disable drag in read-only mode of the editor (#15206)

This commit is contained in:
Jeffrey Chen 2025-07-03 10:11:03 +08:00 committed by GitHub
parent 286223db84
commit 65c7be8dea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -809,6 +809,11 @@ const dragSame = async (protyle: IProtyle, sourceElements: Element[], targetElem
export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
editorElement.addEventListener("dragstart", (event) => {
if (protyle.disabled) {
event.preventDefault();
event.stopPropagation();
return;
}
let target = event.target as HTMLElement;
if (target.classList.contains("av__gallery-img")) {
target = hasClosestByClassName(target, "av__gallery-item") as HTMLElement;