bug fixed

This commit is contained in:
richard-loafle 2020-02-04 17:59:27 +09:00
parent c4e9ebb217
commit 4cf0292204
5 changed files with 25 additions and 12 deletions

View File

@ -327,7 +327,7 @@
(clearView)="clearView()"
(toggleStickerSelector)="onShowToggleStickerSelector($event)"
(toggleTranslation)="onShowToggleTranslation($event)"
(clipboardPaste)="onClipboardPaste()"
(clipboardPaste)="onClipboardPaste($event)"
></ucap-chat-form>
<!-- / REPLY FORM -->
</div>

View File

@ -1965,7 +1965,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
this.translationPreviewInfo = null;
}
onClipboardPaste() {
onClipboardPaste(event: ClipboardEvent) {
this.nativeService.readFromClipboard().then(async data => {
if (!!data.image && !!data.text) {
const result = await this.dialogService.open<
@ -2003,7 +2003,18 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
this.onFileSelected(fileUploadItems);
} else {
this.chatForm.replyInput.nativeElement.value = `${this.chatForm.replyInput.nativeElement.value}${data.text}`;
const v = this.chatForm.replyInput.nativeElement.value;
const selectionStart = this.chatForm.replyInput.nativeElement
.selectionStart;
const selectionEnd = this.chatForm.replyInput.nativeElement
.selectionEnd;
const start = v.substr(0, selectionStart);
const end = v.substr(selectionEnd);
this.chatForm.replyInput.nativeElement.value = `${start}${data.text}${end}`;
event.preventDefault();
}
});
}

View File

@ -32,19 +32,17 @@
</mat-tab> -->
<!-- <mat-tab *ngIf="data.content.html">
<ng-template mat-tab-label>
<mat-checkbox #chkHtml="matCheckbox"> </mat-checkbox>
<mat-checkbox #chkHtml> </mat-checkbox>
<span class="title-text">{{
'common.file.clipboardType.html' | translate
}}</span>
</ng-template>
<perfect-scrollbar>
<div fxFlexFill>
<table
<div
fxFlexFill
[innerHTML]="data.content.html | ucapSafeHtml"
></table>
</div>
></div>
</perfect-scrollbar>
</mat-tab> -->
<mat-tab *ngIf="data.content.image && data.content.imageDataUrl">

View File

@ -35,6 +35,9 @@ export class ClipboardDialogComponent implements OnInit, AfterViewInit {
@ViewChild('chkText', { static: false })
chkText: MatCheckbox;
@ViewChild('chkHtml', { static: false })
chkHtml: MatCheckbox;
@ViewChild('chkImage', { static: false })
chkImage: MatCheckbox;
@ -58,6 +61,7 @@ export class ClipboardDialogComponent implements OnInit, AfterViewInit {
if (choice) {
selected = {
text: !!this.chkText && this.chkText.checked,
html: !!this.chkHtml && this.chkHtml.checked,
image: !!this.chkImage && this.chkImage.checked
};
} else {

View File

@ -35,7 +35,7 @@ export class FormComponent implements OnInit {
clearView = new EventEmitter();
@Output()
clipboardPaste = new EventEmitter();
clipboardPaste = new EventEmitter<ClipboardEvent>();
@ViewChild('replyForm', { static: false })
replyForm: NgForm;
@ -91,6 +91,6 @@ export class FormComponent implements OnInit {
onPasteReply(event: ClipboardEvent) {
event.preventDefault();
this.clipboardPaste.emit();
this.clipboardPaste.emit(event);
}
}