aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/assets/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/assets/javascript')
-rw-r--r--phpBB/assets/javascript/core.js25
-rw-r--r--phpBB/assets/javascript/editor.js3
2 files changed, 28 insertions, 0 deletions
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js
index 806db7d35f..9eb931270a 100644
--- a/phpBB/assets/javascript/core.js
+++ b/phpBB/assets/javascript/core.js
@@ -1233,6 +1233,31 @@ phpbb.applyCodeEditor = function(textarea) {
};
/**
+ * Show drag and drop animation when textarea is present
+ *
+ * This function will enable the drag and drop animation for a specified
+ * textarea.
+ *
+ * @param {object} textarea Textarea DOM object to apply editor to
+ */
+phpbb.showDragNDrop = function(textarea) {
+ if (textarea == null) {
+ return;
+ }
+
+ $('body').on('dragenter dragover', function () {
+ $(textarea).addClass('drag-n-drop');
+ }).on('dragleave dragout dragend drop', function() {
+ $(textarea).removeClass('drag-n-drop');
+ });
+ $(textarea).on('dragenter dragover', function () {
+ $(textarea).addClass('drag-n-drop-highlight');
+ }).on('dragleave dragout dragend drop', function() {
+ $(textarea).removeClass('drag-n-drop-highlight');
+ });
+};
+
+/**
* List of classes that toggle dropdown menu,
* list of classes that contain visible dropdown menu
*
diff --git a/phpBB/assets/javascript/editor.js b/phpBB/assets/javascript/editor.js
index 5fd4f7eae3..c58e4d19dd 100644
--- a/phpBB/assets/javascript/editor.js
+++ b/phpBB/assets/javascript/editor.js
@@ -355,6 +355,9 @@ function getCaretPosition(txtarea) {
textarea = doc.forms[form_name].elements[text_name];
phpbb.applyCodeEditor(textarea);
+ if ($('#attach-panel').length) {
+ phpbb.showDragNDrop(textarea);
+ }
});
})(jQuery);