This is a migrated thread and some comments may be shown as answers.

Disable image paste functionality in Kendo editor

3 Answers 262 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Dekel
Top achievements
Rank 1
Dekel asked on 12 Aug 2015, 01:09 PM

Hi,

When I paste image to the kendo editor it inserted as base64 image tag.

After that I am sending the content of the editor by mail, since many email clients blocking base64 images.

I want to disable this functionality in my project.

Please let me know how I can do it.

Thanks,

3 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 13 Aug 2015, 09:46 AM

Hello Dekel,

You can post-process the editor content, as shown in this how-to help topic, or remove the image tags on the server, prior to sending the e-mail.

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Dekel
Top achievements
Rank 1
answered on 13 Aug 2015, 01:39 PM

Hi,

Found better solution (override paste event on kendo editor):

$("#MailBody").kendoEditor({
resizable: {
content: true,
toolbar: true
},
paste: function (e) {
if ((/^<img src="data:image/).test(e.html)) {
e.html = "";
}
}
});

 

0
Nestor
Top achievements
Rank 2
answered on 06 Feb 2019, 04:27 PM

Hi Dekel

This workaround was very helpful, I restricted my editor to all type of images, something like this:

    function OnPaste(e) {
        if ((/^<img src="/).test(e.html)) {
            alert("Images are not allowed in this field");
            e.html = "";
        }
    }

Tags
Editor
Asked by
Dekel
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Dekel
Top achievements
Rank 1
Nestor
Top achievements
Rank 2
Share this question
or