Merge pull request #218 from NicolasConstant/topic_copy-paste-image
support pasting image from clipboard
This commit is contained in:
commit
5e67c8bdd0
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue