From 1e9a42f4dbe2e51c249af85dc005484d2c27a512 Mon Sep 17 00:00:00 2001 From: leejinho Date: Wed, 8 Jan 2020 18:27:35 +0900 Subject: [PATCH] =?UTF-8?q?#=20=EC=9D=B4=EC=8A=88=EC=82=AC=ED=95=AD=20134?= =?UTF-8?q?=20=EC=9D=B8=EC=82=AC=20=EC=A0=95=EB=B3=B4=20=EC=96=B8=EC=96=B4?= =?UTF-8?q?=20=EC=98=81=EC=96=B4=EB=A1=9C=20=EC=84=A4=EC=A0=95=20=ED=9B=84?= =?UTF-8?q?=20=EB=B6=80=EC=84=9C=20=EC=84=A0=ED=83=9D=20=EC=8B=9C=20?= =?UTF-8?q?=ED=95=98=EB=8B=A8=20=EB=B6=80=EC=84=9C=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=EB=90=98=EC=A7=80=20=EC=95=8A=EC=9D=8C=20::=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=EC=9D=98=20=ED=95=AD=EB=AA=A9=EC=97=90=20=EB=8C=80?= =?UTF-8?q?=ED=95=B4=20=EC=97=B0=EB=8F=99=EB=90=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=EA=B7=B8=EB=9E=A8=20=EC=88=98=EC=A0=95.=2013?= =?UTF-8?q?5=20=EB=B2=88=EC=97=AD=ED=95=9C=20=EB=8C=80=ED=99=94=20?= =?UTF-8?q?=EC=9A=B0=ED=81=B4=EB=A6=AD=20=EC=8B=9C=20=EB=A9=94=EB=89=B4=20?= =?UTF-8?q?=EC=A0=9C=EA=B3=B5=EB=90=98=EC=A7=80=20=EC=95=8A=EC=9D=8C=20::?= =?UTF-8?q?=20=EB=B2=88=EC=97=AD,=20=EB=8C=80=EC=9A=A9=EB=9F=89=EB=B2=88?= =?UTF-8?q?=EC=97=AD=EC=97=90=20=EB=8C=80=ED=95=9C=20=EC=9A=B0=ED=81=B4?= =?UTF-8?q?=EB=A6=AD=20=EC=A7=80=EC=9B=90.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../left-sidenav/organization.component.html | 2 +- .../left-sidenav/organization.component.ts | 21 +++++++-- .../components/messages.component.html | 4 +- .../components/messages.component.ts | 46 ++++++++++++++++++- .../src/lib/models/info.ts | 4 +- .../mass-translation.component.html | 2 + .../message-box/mass-translation.component.ts | 10 ++++ .../message-box/translation.component.html | 3 ++ .../message-box/translation.component.ts | 12 ++++- .../lib/components/messages.component.html | 2 + .../src/lib/components/messages.component.ts | 12 ++++- 11 files changed, 104 insertions(+), 14 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html index 6e0c7274..0731f5f0 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html @@ -32,7 +32,7 @@ {{ 'common.messages.searching' | translate }} ... - {{ selectedDepartmentName }} + {{ selectedDepartmentName | ucapTranslate: 'name' }} diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts index c09d0e0c..58b0b2a8 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts @@ -8,7 +8,11 @@ import { ViewChild, AfterViewChecked } from '@angular/core'; -import { ucapAnimations, DialogService } from '@ucap-webmessenger/ui'; +import { + ucapAnimations, + DialogService, + TranslateService +} from '@ucap-webmessenger/ui'; import { Observable, Subscription, of } from 'rxjs'; import { DeptInfo, @@ -46,7 +50,6 @@ import { Company } from '@ucap-webmessenger/api-external'; import { PerfectScrollbarDirective } from 'ngx-perfect-scrollbar'; import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling'; import { MatMenuTrigger } from '@angular/material'; -import { TranslateService } from '@ngx-translate/core'; import { MessageWriteDialogComponent, MessageWriteDialogResult, @@ -131,7 +134,11 @@ export class OrganizationComponent selectedDepartmentStatus$: Observable; selectedDepartmentProcessing = false; selectedDepartmentProcessingSubscription: Subscription; - selectedDepartmentName: string; + selectedDepartmentName: { + name: string; + nameEn: string; + nameCn: string; + }; loginInfo: LoginInfo; loginRes: LoginResponse; @@ -227,7 +234,11 @@ export class OrganizationComponent }), map(loginRes => { this.loginRes = loginRes; - this.selectedDepartmentName = loginRes.userInfo.deptName; + this.selectedDepartmentName = { + name: loginRes.userInfo.deptName, + nameEn: loginRes.userInfo.deptNameEn, + nameCn: loginRes.userInfo.deptNameCn + }; }) ) .subscribe(); @@ -346,7 +357,7 @@ export class OrganizationComponent ); }), map(() => { - this.selectedDepartmentName = deptInfo.name; + this.selectedDepartmentName = deptInfo; }) ) .subscribe(); diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html index 4e3619a9..3fc5e952 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html @@ -325,12 +325,12 @@ [hasBackdrop]="false" (ucapClickOutside)="messageContextMenuTrigger.closeMenu()" > - + diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts index 061488b2..dd5b892d 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts @@ -1110,6 +1110,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit { onContextMenuMessage(params: { event: MouseEvent; message: Info; + type?: string; }) { params.event.preventDefault(); params.event.stopPropagation(); @@ -1119,12 +1120,25 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit { this.messageContextMenuTrigger.menu.focusFirstItem('mouse'); this.messageContextMenuTrigger.menuData = { message: params.message, - loginRes: this.loginRes + loginRes: this.loginRes, + clicktype: params.type }; this.messageContextMenuTrigger.openMenu(); } - async onClickMessageContextMenu(menuType: string, message: Info) { + async onClickMessageContextMenu( + menuType: string, + message: Info, + clicktype?: string + ) { + this.logger.debug( + 'menuType', + menuType, + 'message', + message, + 'clicktype?', + clicktype + ); switch (menuType) { case 'COPY': { @@ -1177,7 +1191,35 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit { }); } break; + case EventType.Translation: + case EventType.MassTranslation: + { + let trgtStr = ''; + if (clicktype === 'translation') { + // translation + trgtStr = (message.sentMessageJson as TranslationEventJson) + .translation; + } else { + // original + trgtStr = (message.sentMessageJson as TranslationEventJson) + .original; + } + if (this.clipboardService.copyFromContent(trgtStr)) { + this.snackBarService.open( + this.translateService.instant( + 'common.clipboard.results.copied' + ), + '', + { + duration: 3000, + verticalPosition: 'top', + horizontalPosition: 'center' + } + ); + } + } + break; default: break; } diff --git a/projects/ucap-webmessenger-protocol-event/src/lib/models/info.ts b/projects/ucap-webmessenger-protocol-event/src/lib/models/info.ts index 6f972c83..05eaf487 100644 --- a/projects/ucap-webmessenger-protocol-event/src/lib/models/info.ts +++ b/projects/ucap-webmessenger-protocol-event/src/lib/models/info.ts @@ -21,7 +21,9 @@ export interface Info { export function isCopyable(eventType: EventType): boolean { return ( - EventType.Character === eventType || EventType.Translation === eventType + EventType.Character === eventType || + EventType.Translation === eventType || + EventType.MassTranslation === eventType ); } diff --git a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/mass-translation.component.html b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/mass-translation.component.html index be9d40ca..d25ddda8 100644 --- a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/mass-translation.component.html +++ b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/mass-translation.component.html @@ -3,10 +3,12 @@ *ngIf="!translationSimpleview || (!!translationSimpleview && !!isMe)" class="original" [innerHTML]="message.sentMessageJson.original | linky" + (contextmenu)="onContextMenuMessage($event, 'original')" >
{{ message.sentMessageJson.destLocale }} diff --git a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/mass-translation.component.ts b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/mass-translation.component.ts index dc9e85d0..8c5386aa 100644 --- a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/mass-translation.component.ts +++ b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/mass-translation.component.ts @@ -26,6 +26,12 @@ export class MassTranslationComponent implements OnInit { contentsType: string; }>(); + @Output() + contextMenu = new EventEmitter<{ + event: MouseEvent; + type: string; + }>(); + constructor() {} ngOnInit() {} @@ -43,4 +49,8 @@ export class MassTranslationComponent implements OnInit { contentsType }); } + + onContextMenuMessage(event: MouseEvent, type: string) { + this.contextMenu.emit({ event, type }); + } } diff --git a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/translation.component.html b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/translation.component.html index 9f284ee0..14a333b3 100644 --- a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/translation.component.html +++ b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/translation.component.html @@ -6,6 +6,7 @@ this.message.sentMessageJson.stickerfile.trim().length > 0 " class="sticker" + (contextmenu)="onContextMenuMessage($event, 'original')" >
{{ message.sentMessageJson.locale }} diff --git a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/translation.component.ts b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/translation.component.ts index d2b4266d..51985972 100644 --- a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/translation.component.ts +++ b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/translation.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, Input } from '@angular/core'; +import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core'; import { Info, TranslationEventJson } from '@ucap-webmessenger/protocol-event'; @Component({ @@ -16,6 +16,12 @@ export class TranslationComponent implements OnInit { @Input() isMe: boolean; + @Output() + contextMenu = new EventEmitter<{ + event: MouseEvent; + type: string; + }>(); + stickerUrl?: string; constructor() {} @@ -29,4 +35,8 @@ export class TranslationComponent implements OnInit { this.stickerUrl = `assets/sticker/sticker_s_${this.message.sentMessageJson.stickerfile}.png`; } } + + onContextMenuMessage(event: MouseEvent, type: string) { + this.contextMenu.emit({ event, type }); + } } diff --git a/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.html b/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.html index 303b4ec3..b3769536 100644 --- a/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.html +++ b/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.html @@ -187,6 +187,7 @@ [message]="message" [translationSimpleview]="translationSimpleview" [isMe]="message.senderSeq === loginRes.userSeq" + (contextMenu)="onContextMenuMessage($event, message)" class="information-msg" > diff --git a/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.ts b/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.ts index 403564f4..0728c15e 100644 --- a/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.ts +++ b/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.ts @@ -78,6 +78,7 @@ export class MessagesComponent implements OnInit { contextMenu = new EventEmitter<{ event: MouseEvent; message: Info; + type?: string; }>(); messages: Info[]; @@ -248,7 +249,14 @@ export class MessagesComponent implements OnInit { } /** [Event] Context Menu */ - onContextMenuMessage(event: MouseEvent, message: Info) { - this.contextMenu.emit({ event, message }); + onContextMenuMessage(event: any, message: Info) { + if ( + message.type === EventType.Translation || + message.type === EventType.MassTranslation + ) { + this.contextMenu.emit({ event: event.event, message, type: event.type }); + } else { + this.contextMenu.emit({ event, message }); + } } }