This commit is contained in:
leejinho 2020-02-10 17:06:01 +09:00
commit f2759864ce
16 changed files with 99 additions and 25 deletions

View File

@ -2,6 +2,7 @@
<mat-tab-group <mat-tab-group
mat-stretch-tabs mat-stretch-tabs
animationDuration="0ms" animationDuration="0ms"
[backgroundColor]="'transparent'"
(selectedTabChange)="onSelectedTabChange($event)" (selectedTabChange)="onSelectedTabChange($event)"
class="global-menu" class="global-menu"
> >

View File

@ -182,7 +182,11 @@
(fileDragLeave)="onFileDragLeave()" (fileDragLeave)="onFileDragLeave()"
> >
<!-- CHAT MESSAGES --> <!-- CHAT MESSAGES -->
<button mat-stroked-button class=" icon-button text-accent-darkest"> <button
mat-stroked-button
class=" icon-button text-accent-darkest"
(click)="onClickScrollToBottom()"
>
<i class="mid mdi-arrow-collapse-down"></i> <i class="mid mdi-arrow-collapse-down"></i>
</button> </button>

View File

@ -691,7 +691,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
req: { req: {
roomSeq: this.roomInfoSubject.value.roomSeq, roomSeq: this.roomInfoSubject.value.roomSeq,
eventType: EventType.Character, eventType: EventType.Character,
sentMessage: StringUtil.escapeHtml(message) sentMessage: message
} }
}) })
); );
@ -726,7 +726,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
const stickerJson: StickerEventJson = { const stickerJson: StickerEventJson = {
name: '스티커', name: '스티커',
file: this.selectedSticker.index, file: this.selectedSticker.index,
chat: !!message ? StringUtil.escapeHtml(message.trim()) : '' chat: !!message ? message.trim() : ''
}; };
this.store.dispatch( this.store.dispatch(
EventStore.send({ EventStore.send({
@ -751,7 +751,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
roomSeq: this.roomInfoSubject.value.roomSeq, roomSeq: this.roomInfoSubject.value.roomSeq,
eventType: EventType.MassText, eventType: EventType.MassText,
// sentMessage: message.replace(/\n/gi, '\r\n') // sentMessage: message.replace(/\n/gi, '\r\n')
sentMessage: StringUtil.escapeHtml(message) sentMessage: message
} }
}) })
); );
@ -759,7 +759,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
/** Send Translation message */ /** Send Translation message */
sendMessageOfTranslate(message: string) { sendMessageOfTranslate(message: string) {
const destLocale = this.destLocale; const destLocale = this.destLocale;
const original = StringUtil.escapeHtml(message); const original = message;
const roomSeq = this.roomInfoSubject.value.roomSeq; const roomSeq = this.roomInfoSubject.value.roomSeq;
if (!!this.isTranslationProcess) { if (!!this.isTranslationProcess) {
@ -2007,4 +2007,9 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
} }
}); });
} }
onClickScrollToBottom() {
this.chatMessages.initEventMore();
this.chatMessages.scrollToBottom();
}
} }

View File

@ -15,6 +15,12 @@
></app-layout-messenger-left-side> ></app-layout-messenger-left-side>
</mat-drawer> </mat-drawer>
<div class="chat-messages bg-accent-brightest"> <div class="chat-messages bg-accent-brightest">
<!-- <div class="messenger-statusbar-container">
<div class="messenger-statusbar-message">
업데이트가 존재합니다.
</div>
<div class="messenger-statusbar-actions"></div>
</div> -->
<app-layout-messenger-intro <app-layout-messenger-intro
*ngIf="!(this.selectedChat$ | async)" *ngIf="!(this.selectedChat$ | async)"
></app-layout-messenger-intro> ></app-layout-messenger-intro>

View File

@ -16,10 +16,26 @@
flex: 1 1 auto; flex: 1 1 auto;
min-width: 320px; min-width: 320px;
height: 100%; height: 100%;
.chat-messages { .chat-messages {
width: 100%; width: 100%;
height: 100%; height: 100%;
font-size: 1em; font-size: 1em;
.messenger-statusbar-container {
width: 100%;
height: 25px;
background-color: silver;
text-align: center;
.messenger-statusbar-message {
width: calc(100% - 20px);
height: 100%;
}
.messenger-statusbar-actions {
}
}
} }
.rightDrawer { .rightDrawer {
width: 320px; width: 320px;

View File

@ -391,6 +391,14 @@ $daesang-grey: (
background-color: transparent; background-color: transparent;
} }
app-page-messenger-main mat-drawer-content {
overflow: hidden !important;
}
.mat-tab-labels .cdk-focused {
background-color: transparent !important;
}
.messages .container { .messages .container {
background: mat-color($accent, 50); background: mat-color($accent, 50);
} }
@ -455,12 +463,12 @@ $daesang-grey: (
background-color: mat-color($accent, 500); background-color: mat-color($accent, 500);
} }
} }
.chatroom-search{ .chatroom-search {
.search-form{ .search-form {
border: 2px solid mat-color($accent, B100); border: 2px solid mat-color($accent, B100);
} }
.btns{ .btns {
background-color: mat-color($accent, B100); background-color: mat-color($accent, B100);
} }
} }
} }

View File

@ -165,11 +165,16 @@ $tablet-s-width: 768px;
} }
} }
} }
.bubble-main { ::ng-deep .bubble-main {
word-wrap: break-word; word-wrap: break-word;
white-space: pre-wrap; white-space: pre-wrap;
word-break: break-word; word-break: break-word;
a {
color: #0367a6;
text-decoration: underline;
}
} }
::ng-deep .view-previous { ::ng-deep .view-previous {
display: flex; display: flex;
flex-flow: column; flex-flow: column;

View File

@ -2,7 +2,7 @@
<div <div
*ngIf="!translationSimpleview || (!!translationSimpleview && !!isMe)" *ngIf="!translationSimpleview || (!!translationSimpleview && !!isMe)"
class="original" class="original"
[innerHTML]="message.sentMessageJson.original | linky" [innerHTML]="message.sentMessageJson.original | ucapSafeHtml | linky"
(contextmenu)="onContextMenuMessage($event, 'original')" (contextmenu)="onContextMenuMessage($event, 'original')"
></div> ></div>
<div <div
@ -11,7 +11,10 @@
(contextmenu)="onContextMenuMessage($event, 'translation')" (contextmenu)="onContextMenuMessage($event, 'translation')"
> >
<span class="language">{{ message.sentMessageJson.destLocale }}</span> <span class="language">{{ message.sentMessageJson.destLocale }}</span>
<span [innerHTML]="message.sentMessageJson.translation | linky"> </span> <span
[innerHTML]="message.sentMessageJson.translation | ucapSafeHtml | linky"
>
</span>
</div> </div>
<div class="btn-box"> <div class="btn-box">
<ul> <ul>

View File

@ -1,5 +1,8 @@
<div class="bubble-main"> <div class="bubble-main">
<span class="content" [innerHTML]="content | linefeedtohtml | linky"></span> <span
class="content"
[innerHTML]="content | linefeedtohtml | ucapSafeHtml | linky"
></span>
<span> <span>
{{ message.sendDate | ucapDate: 'YYYY.MM.DD a hh:mm' }} {{ message.sendDate | ucapDate: 'YYYY.MM.DD a hh:mm' }}
</span> </span>

View File

@ -6,6 +6,9 @@
onerror="this.src='assets/sticker/sticker_default.png'" onerror="this.src='assets/sticker/sticker_default.png'"
/> />
</li> </li>
<li *ngIf="contents" [innerHTML]="contents | linefeedtohtml | linky"></li> <li
*ngIf="contents"
[innerHTML]="contents | linefeedtohtml | ucapSafeHtml | linky"
></li>
</ul> </ul>
</div> </div>

View File

@ -1,3 +1,3 @@
<div class="bubble-main"> <div class="bubble-main">
<span [innerHTML]="message.sentMessage | linky"></span> <span [innerHTML]="message.sentMessage | ucapSafeHtml | linky"></span>
</div> </div>

View File

@ -69,7 +69,10 @@
<i class="mdi mid-18 mdi-bell-off-outline text-primary-light"></i> <i class="mdi mid-18 mdi-bell-off-outline text-primary-light"></i>
</div> </div>
</div> </div>
<div class="final-message" [innerHTML]="finalEventMessage"></div> <div
class="final-message"
[innerHTML]="finalEventMessage | ucapSafeHtml"
></div>
</div> </div>
<div class="date"> <div class="date">

View File

@ -171,14 +171,7 @@
*ngIf="fileDownloadUrl" *ngIf="fileDownloadUrl"
[src]="fileDownloadUrl" [src]="fileDownloadUrl"
[style.width]="'auto'" [style.width]="'auto'"
[style.height]=" [style.height]="getImageHeight(imageContainer.clientHeight)"
naturalHeight > imageContainer.clientHeight
? ((imageContainer.clientHeight - 20) / naturalHeight) *
(zoomRatio / 100) *
naturalHeight +
'px'
: naturalHeight + 'px'
"
(load)="onLoadFileDownloadUrl(downloadImage)" (load)="onLoadFileDownloadUrl(downloadImage)"
/> />
</div> </div>

View File

@ -82,4 +82,14 @@ export class ImageViewerComponent implements OnInit {
this.changeDetectorRef.detectChanges(); this.changeDetectorRef.detectChanges();
} }
getImageHeight(containerHeight: number): string {
const realContainerHeight = containerHeight - 20;
const oriHeight =
this.naturalHeight > realContainerHeight
? realContainerHeight
: this.naturalHeight;
return oriHeight * (this.zoomRatio / 100) + 'px';
}
} }

View File

@ -1,11 +1,15 @@
import { Pipe, PipeTransform } from '@angular/core'; import { Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser'; import { DomSanitizer } from '@angular/platform-browser';
import { StringUtil } from '../utils/string.util';
@Pipe({ name: 'ucapSafeHtml' }) @Pipe({ name: 'ucapSafeHtml' })
export class SafeHtmlPipe implements PipeTransform { export class SafeHtmlPipe implements PipeTransform {
constructor(private domSanitizer: DomSanitizer) {} constructor(private domSanitizer: DomSanitizer) {}
public transform(value: string) { public transform(value: string) {
return this.domSanitizer.bypassSecurityTrustHtml(value); // return this.domSanitizer.bypassSecurityTrustHtml(
// StringUtil.escapeHtml(value)
// );
return StringUtil.escapeHtml(value);
} }
} }

View File

@ -0,0 +1,10 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class StatusBarService {
public constructor() {}
open() {}
}