* Mail: fix drag-n-drop files from desktop no longer works on htmlarea as expected

This commit is contained in:
Hadi Nategh 2019-08-28 16:16:36 +02:00
parent 5877f3d0f1
commit 8506bf5e5f
3 changed files with 35 additions and 2 deletions

View File

@ -149,6 +149,7 @@ var et2_htmlarea = (function(){ "use strict"; return et2_editableWidget.extend([
language: et2_htmlarea.LANGUAGE_CODE[egw.preference('lang', 'common')],
language_url: egw.webserverUrl+'/api/js/tinymce/langs/'+et2_htmlarea.LANGUAGE_CODE[egw.preference('lang', 'common')]+'.js',
paste_data_images: true,
paste_filter_drop: false,
browser_spellcheck: true,
contextmenu: false,
images_upload_url: imageUpload,
@ -309,6 +310,11 @@ var et2_htmlarea = (function(){ "use strict"; return et2_editableWidget.extend([
// current focus.
var focusedEl = jQuery(':focus');
this.editor = _editor;
this.editor.on('drop', function(e){
e.preventDefault();
});
if (!this.disabled) jQuery(this.editor.editorContainer).css('display', 'flex');
this.tinymce_container = this.editor.editorContainer;
// go back to reserved focused element

View File

@ -3210,4 +3210,25 @@ tr.disableIfNoEPL {
.et2_editable {
cursor: url(images/cursor_editable.svg), pointer;
}
}
.dragover {
position: relative;
}
.dragover::after {
content: ' ';
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
background: #ffffff;
opacity: 0.9;
font-size: 20pt;
font-weight: bold;
text-align: center;
background-image: url(images/drop.svg);
background-position: center;
background-size: 20%;
background-repeat: no-repeat;
border: 2px dashed silver;
}

View File

@ -262,9 +262,15 @@ app.classes.mail = AppJS.extend(
});
/*Trigger compose_resizeHandler after the TinyMCE is fully loaded*/
jQuery('#mail-compose').on ('load',function() {
if (textAreaWidget && textAreaWidget.tinymce)
{
textAreaWidget.tinymce.then(()=>{that.compose_resizeHandler()});
textAreaWidget.tinymce.then(()=>{
that.compose_resizeHandler();
jQuery(textAreaWidget.editor.iframeElement.contentWindow.document).on('dragenter', function(){
jQuery('#mail-compose').addClass('dragover');
});
});
}
else
{