Hi all, finally got to the bottom of this.
The issues root is in the "avia_media.js" file inside theme-folder/framework/js .
The following code is also run by run WordPress and this causes a duplication of some sort.
window.original_send_to_editor = window.send_to_editor;
window.send_to_editor = function(html)
{
if(avia_media.aviaUseCustomEditor)
{
var container = avia_media.insertContainer,
returned = $(html),
img = returned.attr('src') || returned.find('img').attr('src') || returned.attr('href'),
visualInsert = '';
container.find('.avia_upload_input').val(img).trigger('change');
if(img.match(/.jpg$|.jpeg$|.png$|.gif$/))
{
visualInsert = 'remove
';
}
else
{
visualInsert = 'remove
';
}
container.find('.avia_preview_pic').html(visualInsert);
tb_remove();
avia_media.reset_uploader();
}
else
{
window.original_send_to_editor(html);
}
};
To fix the issue replace "window.original_send_to_editor" variable with your own custom name.
window.custom_original_send_to_editor = window.send_to_editor;
Then remember to change it at the bottom of the function as well
...........
tb_remove();
avia_media.reset_uploader();
}
else
{
window.custom_original_send_to_editor(html);
}
};
Thanks to "helgatheviking" at this post: https://github.com/woothemes/woocommerce/issues/613 .
Regards
@dwainm