5

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

Atanas Korchev
  • 30,562
  • 8
  • 59
  • 93
Jonathan
  • 1,659
  • 8
  • 34
  • 54

1 Answers1

5

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

Community
  • 1
  • 1
Atanas Korchev
  • 30,562
  • 8
  • 59
  • 93