How can I paste an image from the clipboard to Kendo UI Editor?

kendo-ui

Solution

Here is a related question. Seems to work in latest Chrome and Firefox. And can be plugged in the Kendo Editor via some 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

Problem

I am using the Kendo UI Editor widget. I want to paste the content of the print screen. How can I do that? Regards, Naidu

Original source

Related problems