blob: d2b93d06909b1924948512471687568ce3dce3d1 [file] [log] [blame]
Adrià Vilanova Martínezd269c622021-09-04 18:35:55 +02001import {isOptionEnabled} from '../../common/optionsUtils.js';
2
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}