fix not working dragging images into CKEditor of mail compose in FireFox

This commit is contained in:
Ralf Becker 2014-11-27 13:44:50 +00:00
parent 86c3974d09
commit 5bed0cdf77
2 changed files with 15 additions and 4 deletions

View File

@ -70,6 +70,12 @@ var et2_htmlarea = et2_inputWidget.extend(
description: "The value of the widget", description: "The value of the widget",
type: "html", // "string" would remove html tags by running html_entity_decode type: "html", // "string" would remove html tags by running html_entity_decode
default: et2_no_init default: et2_no_init
},
imageDataUrl: {
name: "imageDataUrl",
description: "Allow images dragged in as data-url, default false = handle them as fileupload",
type: "boolean",
default: false
} }
}, },
@ -136,7 +142,7 @@ var et2_htmlarea = et2_inputWidget.extend(
delete self.value; delete self.value;
} }
} }
if(this.ckeditor && this.options.config.preference_style) if(this.ckeditor && this.options.config.preference_style)
{ {
var editor = this.ckeditor; var editor = this.ckeditor;
@ -171,13 +177,18 @@ var et2_htmlarea = et2_inputWidget.extend(
return ''; return '';
}); });
return ret; return ret;
} };
var chkImg = function(e) { var chkImg = function(e) {
// don't execute code if the editor is readOnly // don't execute code if the editor is readOnly
if (editor.readOnly) if (editor.readOnly)
return; return;
// allow data-URL, returning false to stop regular upload
if (self.options.imageDataUrl)
{
return false;
}
// Remove the image from the text // Remove the image from the text
setTimeout( function() { setTimeout( function() {
editor.document.$.body.innerHTML = replaceImgText(editor.document.$.body.innerHTML); editor.document.$.body.innerHTML = replaceImgText(editor.document.$.body.innerHTML);
@ -203,7 +214,7 @@ var et2_htmlarea = et2_inputWidget.extend(
editor.document.getBody().on('drop', chkImg); editor.document.getBody().on('drop', chkImg);
}); });
} }
}, },
destroy: function() { destroy: function() {

View File

@ -106,7 +106,7 @@
</vbox> </vbox>
<vbox class="mailComposeBodySection" width="99%"> <vbox class="mailComposeBodySection" width="99%">
<hbox disabled="@is_plain" class="mailComposeBody"> <hbox disabled="@is_plain" class="mailComposeBody">
<htmlarea span="all" name="mail_htmltext" id="mail_htmltext" expand_toolbar="true" height="478px" width="100%" /> <htmlarea span="all" name="mail_htmltext" id="mail_htmltext" imageDataUrl="true" expand_toolbar="true" height="478px" width="100%" />
</hbox> </hbox>
<hbox disabled="@is_html" class="mailComposeBody"> <hbox disabled="@is_html" class="mailComposeBody">
<textbox multiline="true" rows="40" cols="120" width="100%" span="all" no_lang="1" name="mail_plaintext" id="mail_plaintext"/> <textbox multiline="true" rows="40" cols="120" width="100%" span="all" no_lang="1" name="mail_plaintext" id="mail_plaintext"/>