testing pasting

This commit is contained in:
Nicolas Constant 2020-02-15 22:21:58 -05:00
parent fb79e53b96
commit 252313aac2
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
2 changed files with 24 additions and 7 deletions

View File

@ -1,4 +1,4 @@
<form class="status-editor" (ngSubmit)="onSubmit()" (paste)="onPaste($event)" > <form class="status-editor" (ngSubmit)="onSubmit()">
<input [(ngModel)]="title" type="text" class="form-control form-control-sm status-editor__title" name="title" <input [(ngModel)]="title" type="text" class="form-control form-control-sm status-editor__title" name="title"
autocomplete="off" placeholder="Title, Content Warning (optional)" title="title, content warning (optional)" dir="auto" /> autocomplete="off" placeholder="Title, Content Warning (optional)" title="title, content warning (optional)" dir="auto" />
@ -7,7 +7,7 @@
<img class="status-editor__emoji--image" src="/assets/emoji/72x72/1f636.png"> <img class="status-editor__emoji--image" src="/assets/emoji/72x72/1f636.png">
</a> </a>
<textarea #reply [(ngModel)]="status" name="status" class="form-control form-control-sm status-editor__content" <textarea #reply [(ngModel)]="status" name="status" class="form-control form-control-sm status-editor__content" (paste)="onPaste($event)"
rows="5" required title="content" placeholder="What's in your mind?" (keydown.control.enter)="onCtrlEnter()" rows="5" required title="content" placeholder="What's in your mind?" (keydown.control.enter)="onCtrlEnter()"
(keydown)="handleKeyDown($event)" (blur)="statusTextEditorLostFocus()" dir="auto"> (keydown)="handleKeyDown($event)" (blur)="statusTextEditorLostFocus()" dir="auto">
</textarea> </textarea>

View File

@ -206,8 +206,25 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
this.accountSub.unsubscribe(); this.accountSub.unsubscribe();
} }
onPaste(ev: ClipboardEvent){ onPaste(e: ClipboardEvent ) {
console.warn(ev); console.log(e);
// e.stopPropagation();
// e.preventDefault();
// console.warn(e);
// console.warn(ev.clipboardData.getData('image'));
// console.warn(ev.clipboardData.getData());
// 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 {