mirror of
https://github.com/laurent22/joplin.git
synced 2026-10-25 02:47:28 +00:00
This commit is contained in:
1 parent
4d36a87296
commit
cbd3445de9
1 file changed
+6
-1
@@ -405,10 +405,15 @@ const InnerSurface = ({ canvas, onChange }: Props) => {
|
||||
);
|
||||
|
||||
const onDragOver = useCallback((e: ReactDragEvent<HTMLDivElement>) => {
|
||||
const effectAllowed = e.dataTransfer.effectAllowed;
|
||||
const canLink = effectAllowed.toLowerCase().includes('link') || ['all', 'uninitialized'].includes(effectAllowed);
|
||||
|
||||
const types = Array.from(e.dataTransfer.types);
|
||||
if (types.includes('text/x-jop-note-ids') || types.includes('text/x-jop-resource-ids')) {
|
||||
e.preventDefault();
|
||||
e.dataTransfer.dropEffect = 'link';
|
||||
// Workaround: On Linux, the 'link' drag effect prevents dropping items into the editor.
|
||||
// See https://github.com/laurent22/joplin/issues/16457.
|
||||
e.dataTransfer.dropEffect = canLink ? 'link' : 'copy';
|
||||
} else if (types.includes('Files')) {
|
||||
e.preventDefault();
|
||||
e.dataTransfer.dropEffect = 'copy';
|
||||
|
||||
Reference in new issue
Block a user