TMS, 코끼리 알림 >> 알림 이벤트 내 contents 의 링크 생성 기능 추가.

This commit is contained in:
leejinho 2020-03-24 10:18:18 +09:00
parent 67b04ef850
commit 71187d64f5
2 changed files with 38 additions and 6 deletions

View File

@ -11,9 +11,12 @@
<span class="bg-accent-dark">{{ 'chat.sentDate' | translate }}</span> <span class="bg-accent-dark">{{ 'chat.sentDate' | translate }}</span>
{{ message.sentMessageJson.postDate | ucapDate: 'YYYY.MM.DD a hh:mm' }} {{ message.sentMessageJson.postDate | ucapDate: 'YYYY.MM.DD a hh:mm' }}
</li> </li>
<li class="event-content"> <li
{{ message.sentMessageJson.content }} class="event-content"
</li> [innerHTML]="
message.sentMessageJson.content | ucapSafeHtml | linefeedtohtml | linky
"
></li>
</ul> </ul>
<!-- <div class="btn-box"> <!-- <div class="btn-box">
<button mat-button (click)="onClickSave()">상세보기</button> <button mat-button (click)="onClickSave()">상세보기</button>

View File

@ -1,16 +1,45 @@
import { Component, OnInit, Input } from '@angular/core'; import {
Component,
OnInit,
Input,
AfterViewInit,
ElementRef,
Inject
} from '@angular/core';
import { Info, AllimEventJson } from '@ucap-webmessenger/protocol-event'; import { Info, AllimEventJson } from '@ucap-webmessenger/protocol-event';
import { UCAP_NATIVE_SERVICE, NativeService } from '@ucap-webmessenger/native';
@Component({ @Component({
selector: 'ucap-chat-message-box-allim', selector: 'ucap-chat-message-box-allim',
templateUrl: './allim.component.html', templateUrl: './allim.component.html',
styleUrls: ['./allim.component.scss'] styleUrls: ['./allim.component.scss']
}) })
export class AllimComponent implements OnInit { export class AllimComponent implements OnInit, AfterViewInit {
@Input() @Input()
message: Info<AllimEventJson>; message: Info<AllimEventJson>;
constructor() {} constructor(
private elementRef: ElementRef,
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService
) {}
ngOnInit() {} ngOnInit() {}
ngAfterViewInit(): void {
if (
!!this.elementRef.nativeElement &&
!!this.elementRef.nativeElement.querySelector('a')
) {
const elements = this.elementRef.nativeElement.querySelectorAll('a');
elements.forEach(element => {
element.addEventListener('click', this.onClickEvent.bind(this));
});
}
}
onClickEvent(event: MouseEvent) {
this.nativeService.openDefaultBrowser(
(event.target as HTMLAnchorElement).text
);
}
} }