Skip to content

A platform for community discussion. Free, open, simple.

FIX: (safari-only) avoid image duplication on cross-window drop to rich editor (#35643)

Renato Atilio118b182dbada
diff --git a/frontend/discourse/app/static/prosemirror/components/prosemirror-editor.gjs b/frontend/discourse/app/static/prosemirror/components/prosemirror-editor.gjs
index 37c0c2fca67..cf1742cdd0d 100644
--- a/frontend/discourse/app/static/prosemirror/components/prosemirror-editor.gjs
+++ b/frontend/discourse/app/static/prosemirror/components/prosemirror-editor.gjs
@@ -214,6 +214,15 @@ export default class ProsemirrorEditor extends Component {
next(() => this.args.focusOut?.());
return false;
},
+ drop: (view, event) => {
+ if (
+ [...event.dataTransfer.items].some((item) => item.kind === "file")
+ ) {
+ // Skip processing the drop event (e.g. Safari cross-window content drag),
+ // Uppy's DropTarget should handle that instead.
+ return true;
+ }
+ },
},
handleKeyDown: (view, event) => {
// suppress if Enter/Tab and the autocomplete is open