From 621883a0cebfc02f4f982b3fb8dc891de4486087 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Fri, 10 Aug 2018 17:54:09 -0700 Subject: [PATCH] Disable drag and drop if it's not a file attachment --- js/background.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/js/background.js b/js/background.js index 8990e20df..fffb75917 100644 --- a/js/background.js +++ b/js/background.js @@ -14,6 +14,24 @@ (async function() { 'use strict'; + // Globally disable drag and drop + document.body.addEventListener( + 'dragover', + e => { + e.preventDefault(); + e.stopPropagation(); + }, + false + ); + document.body.addEventListener( + 'drop', + e => { + e.preventDefault(); + e.stopPropagation(); + }, + false + ); + // Load these images now to ensure that they don't flicker on first use const images = []; function preload(list) {