Merge pull request #218 from NicolasConstant/topic_copy-paste-image

support pasting image from clipboard
This commit is contained in:
Nicolas Constant 2020-02-19 20:11:28 -05:00 committed by GitHub
commit 5e67c8bdd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 19 deletions

View File

@ -206,25 +206,16 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
this.accountSub.unsubscribe(); this.accountSub.unsubscribe();
} }
onPaste(e: ClipboardEvent ) { onPaste(e: any) {
console.log(e); const items = (e.clipboardData || e.originalEvent.clipboardData).items;
let blobs: File[] = [];
// e.stopPropagation(); for (const item of items) {
// e.preventDefault(); if (item.type.indexOf('image') === 0) {
let blob = item.getAsFile();
// console.warn(e); blobs.push(blob);
}
// console.warn(ev.clipboardData.getData('image')); }
// console.warn(ev.clipboardData.getData()); this.handleFileInput(blobs);
// navigator['clipboard'].readText().then(clipText => {
// console.log(clipText);
// });
// var items = (ev.clipboardData || ev.originalEvent.clipboardData).items;
// console.error(items);
} }
changePrivacy(value: string): boolean { changePrivacy(value: string): boolean {