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()" (clearView)="clearView()"
(toggleStickerSelector)="onShowToggleStickerSelector($event)" (toggleStickerSelector)="onShowToggleStickerSelector($event)"
(toggleTranslation)="onShowToggleTranslation($event)" (toggleTranslation)="onShowToggleTranslation($event)"
(clipboardPaste)="onClipboardPaste()" (clipboardPaste)="onClipboardPaste($event)"
></ucap-chat-form> ></ucap-chat-form>
<!-- / REPLY FORM --> <!-- / REPLY FORM -->
</div> </div>

View File

@ -1965,7 +1965,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
this.translationPreviewInfo = null; this.translationPreviewInfo = null;
} }
onClipboardPaste() { onClipboardPaste(event: ClipboardEvent) {
this.nativeService.readFromClipboard().then(async data => { this.nativeService.readFromClipboard().then(async data => {
if (!!data.image && !!data.text) { if (!!data.image && !!data.text) {
const result = await this.dialogService.open< const result = await this.dialogService.open<
@ -2003,7 +2003,18 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
this.onFileSelected(fileUploadItems); this.onFileSelected(fileUploadItems);
} else { } 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> -->
<!-- <mat-tab *ngIf="data.content.html"> <!-- <mat-tab *ngIf="data.content.html">
<ng-template mat-tab-label> <ng-template mat-tab-label>
<mat-checkbox #chkHtml="matCheckbox"> </mat-checkbox> <mat-checkbox #chkHtml> </mat-checkbox>
<span class="title-text">{{ <span class="title-text">{{
'common.file.clipboardType.html' | translate 'common.file.clipboardType.html' | translate
}}</span> }}</span>
</ng-template> </ng-template>
<perfect-scrollbar> <perfect-scrollbar>
<div fxFlexFill> <div
<table
fxFlexFill fxFlexFill
[innerHTML]="data.content.html | ucapSafeHtml" [innerHTML]="data.content.html | ucapSafeHtml"
></table> ></div>
</div>
</perfect-scrollbar> </perfect-scrollbar>
</mat-tab> --> </mat-tab> -->
<mat-tab *ngIf="data.content.image && data.content.imageDataUrl"> <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 }) @ViewChild('chkText', { static: false })
chkText: MatCheckbox; chkText: MatCheckbox;
@ViewChild('chkHtml', { static: false })
chkHtml: MatCheckbox;
@ViewChild('chkImage', { static: false }) @ViewChild('chkImage', { static: false })
chkImage: MatCheckbox; chkImage: MatCheckbox;
@ -58,6 +61,7 @@ export class ClipboardDialogComponent implements OnInit, AfterViewInit {
if (choice) { if (choice) {
selected = { selected = {
text: !!this.chkText && this.chkText.checked, text: !!this.chkText && this.chkText.checked,
html: !!this.chkHtml && this.chkHtml.checked,
image: !!this.chkImage && this.chkImage.checked image: !!this.chkImage && this.chkImage.checked
}; };
} else { } else {

View File

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