blob: 08390714805be2530d68b70de34e97c86c9b3cfe [file] [log] [blame]
Adrià Vilanova Martínezb523be92024-05-25 19:14:19 +02001import {isOptionEnabled} from '../../common/options/optionsUtils.js';
Adrià Vilanova Martínezd269c622021-09-04 18:35:55 +02002
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +02003export function applyDragAndDropFix(node) {
4 console.debug('Adding link drag&drop fix to ', node);
5 node.addEventListener('drop', e => {
6 if (e.dataTransfer.types.includes('text/uri-list')) {
7 e.stopImmediatePropagation();
8 console.debug('Stopping link drop event propagation.');
9 }
10 }, true);
11}
Adrià Vilanova Martínezd269c622021-09-04 18:35:55 +020012
13export function applyDragAndDropFixIfEnabled(node) {
14 isOptionEnabled('ccdragndropfix').then(isEnabled => {
15 if (isEnabled) applyDragAndDropFix(node);
16 });
17}