Adrià Vilanova Martínez | b523be9 | 2024-05-25 19:14:19 +0200 | [diff] [blame] | 1 | import {isOptionEnabled} from '../../common/options/optionsUtils.js'; |
Adrià Vilanova Martínez | d269c62 | 2021-09-04 18:35:55 +0200 | [diff] [blame] | 2 | |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 3 | export 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ínez | d269c62 | 2021-09-04 18:35:55 +0200 | [diff] [blame] | 12 | |
| 13 | export function applyDragAndDropFixIfEnabled(node) { |
| 14 | isOptionEnabled('ccdragndropfix').then(isEnabled => { |
| 15 | if (isEnabled) applyDragAndDropFix(node); |
| 16 | }); |
| 17 | } |