From a2b96f0c9ce5708dfe45eb4352ff82da91a1783d Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 7 Aug 2015 15:22:20 +0000 Subject: [PATCH] WIP image upload via drag into ckeditor 4.5: DO not trigger et2_file uplaod if it is an type image and let CKEditor handles it --- etemplate/js/et2_widget_htmlarea.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/etemplate/js/et2_widget_htmlarea.js b/etemplate/js/et2_widget_htmlarea.js index 18d4a4683c..14b9e77a25 100644 --- a/etemplate/js/et2_widget_htmlarea.js +++ b/etemplate/js/et2_widget_htmlarea.js @@ -193,9 +193,12 @@ var et2_htmlarea = et2_inputWidget.extend([et2_IResizeable], editor.document.$.body.innerHTML = replaceImgText(editor.document.$.body.innerHTML); },200); } - + + // Supported file types for dropping on CKEditor imageUpload plugin + var supportedTypesByCKEditor = /image\/(jpeg|png|gif)/; + // Try to pass the image into the first et2_file that will accept it - if(e.data.$.dataTransfer) + if(e.data.$.dataTransfer && !CKEDITOR.fileTools.isTypeSupported(e.data.$.dataTransfer.files[0],supportedTypesByCKEditor)) { self.getRoot().iterateOver(function(widget) { if(widget.options.drop_target)