So, I am trying to understand pasteand copyAPI in Google Chrome. I do not understand too.
As with copy, you probably want to use javascript to add something to the clipboard . I work with images (strings work really well 1 ):
var files = items.items;
if(files) {
console.log(files);
var blob = Blob.fromDataURL(_this.editor.selection.getSelectedImage().toDataURL("image/png"));
var file;
try {
file = new File([blob], "image.png", {type:"image/png"});
}
catch(e) {
return false;
}
if(file) {
files.clear();
files.add(file, "image/png");
}
}
The problem is that I really don't know how this method works add. I found this “documentation” for a DataTransferItemList that says:
add(any data, optional DOMString type)
? ( - ?) - , , . - Chrome. , DataTransferItemList:

, <img>:
ImageEditorKeyboard.prototype.processFile = function(file) {
var reader = new FileReader();
var _this = this;
reader.onload = function(event) {
var img = new Image;
img.onload = function() {
_this.processImage(this);
};
img.src = event.target.result;
};
reader.readAsDataURL(file);
}
2:

event.target.result, , :
console.error("String '", event.target.result, "' ain't a valid URL!");

- Q:
DataTransferItemList, , .add?
1: ( , !), : event.clipboardData.setData(data, "text/plain");. , , - image/png .
2: , .