How can I paste an image from the clipboard into the Kendo user interface editor?

I am using the Kendo UI Editor widget. I want to insert the contents of a print screen. How can i do this?

Hello,

I will find

+4
source share
1 answer

Here is a related question. Seems to work in the latest Chrome and Firefox. And you can connect the Kendo editor through the code:

var editor = $("#editor").data("kendoEditor"); $(editor.document).on("paste", function(e) { var clipboard = e.originalEvent.clipboardData; if (clipboard && clipboard.items) { var screenshot = clipboard.items[0]; if (screenshot.kind == "file") { var blob = screenshot.getAsFile(); var reader = new FileReader(); reader.onload = function(event){ var html = kendo.format('<img src="{0}"/>', event.target.result); editor.paste(html); }; reader.readAsDataURL(blob); } } }); 

And here is a live demo: http://jsbin.com/utapal/1/edit

+4
source

All Articles