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,5 +1,5 @@
<form class="status-editor" (ngSubmit)="onSubmit()" (paste)="onPaste($event)" >
<input [(ngModel)]="title" type="text" class="form-control form-control-sm status-editor__title" name="title"
<form class="status-editor" (ngSubmit)="onSubmit()">
<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" />
<a class="status-editor__emoji" title="Insert Emoji"
@ -7,7 +7,7 @@
<img class="status-editor__emoji--image" src="/assets/emoji/72x72/1f636.png">
</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()"
(keydown)="handleKeyDown($event)" (blur)="statusTextEditorLostFocus()" dir="auto">
</textarea>

View File

@ -206,8 +206,25 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
this.accountSub.unsubscribe();
}
onPaste(ev: ClipboardEvent){
console.warn(ev);
onPaste(e: ClipboardEvent ) {
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 {
@ -228,8 +245,8 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
private detectAutosuggestion(status: string) {
if (!this.statusLoaded) return;
if(!status.includes('@') && !status.includes('#')){
if (!status.includes('@') && !status.includes('#')) {
this.autosuggestData = null;
this.hasSuggestions = false;
return;