From 3f3dec8d1e9fe11b3ef88b97ed8e518815ea4576 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 21 Aug 2017 14:07:57 +0200 Subject: [PATCH] Fixed drag & drop behavior in Firefox --- .../WoltLabSuite/Core/Ui/Redactor/DragAndDrop.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/DragAndDrop.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/DragAndDrop.js index ad8abe04bd..56a3d29a54 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/DragAndDrop.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/DragAndDrop.js @@ -181,6 +181,20 @@ define(['Dictionary', 'EventHandler', 'Language'], function (Dictionary, EventHa _isDragging = false; }, + /** + * Handles the global drop event. + * + * @param {Event} event + * @protected + */ + _globalDrop: function (event) { + if (event.target.closest('.redactor-layer') === null) { + event.preventDefault(); + } + + this._dragLeave(event); + }, + /** * Binds listeners to global events. * @@ -192,7 +206,7 @@ define(['Dictionary', 'EventHandler', 'Language'], function (Dictionary, EventHa window.addEventListener('dragover', this._dragOver.bind(this)); window.addEventListener('dragleave', this._dragLeave.bind(this)); - window.addEventListener('drop', this._dragLeave.bind(this)); + window.addEventListener('drop', this._globalDrop.bind(this)); _didInit = true; } -- 2.20.1