mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-09 07:28:43 +01:00
Instead of replacing a dropped image with an error image, we'll remove it, and pass the image to the first et2_file widget with a drop target. That's not ideal, but it should work for us in most cases until CKEditor fully supports drag and drop.
(Firefox only)
This commit is contained in:
parent
08c10a70aa
commit
7eb528ee1f
@ -168,19 +168,32 @@ var et2_htmlarea = et2_inputWidget.extend(
|
|||||||
// when dragging, so we replace dropped images with error icon.
|
// when dragging, so we replace dropped images with error icon.
|
||||||
var replaceImgText = function(html) {
|
var replaceImgText = function(html) {
|
||||||
var ret = html.replace( /<img[^>]*src="(data:.*;base64,.*?)"[^>]*>/gi, function( img, src ){
|
var ret = html.replace( /<img[^>]*src="(data:.*;base64,.*?)"[^>]*>/gi, function( img, src ){
|
||||||
return img.replace(src,egw.image('error'));
|
return '';
|
||||||
});
|
});
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
var chkImg = function() {
|
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;
|
||||||
|
|
||||||
|
// 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);
|
||||||
},200);
|
},200);
|
||||||
|
|
||||||
|
// Try to pass the image into the first et2_file that will accept it
|
||||||
|
if(e.data.$.dataTransfer)
|
||||||
|
{
|
||||||
|
self.getRoot().iterateOver(function(widget) {
|
||||||
|
if(widget.options.drop_target)
|
||||||
|
{
|
||||||
|
widget.set_value(e.data.$.dataTransfer.files,e.data.$);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
},e.data.$,et2_file);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
editor.on( 'contentDom', function() {
|
editor.on( 'contentDom', function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user