Edit & forward original date in message time title
This commit is contained in:
parent
0184d89a48
commit
cdf0a95035
@ -1,3 +1,5 @@
|
||||
import { getFullDate } from "../../helpers/date";
|
||||
import RichTextProcessor from "../../lib/richtextprocessor";
|
||||
import { formatNumber } from "../../lib/utils";
|
||||
|
||||
type Message = any;
|
||||
@ -12,8 +14,10 @@ export namespace MessageRender {
|
||||
let time = ('0' + date.getHours()).slice(-2) + ':' + ('0' + date.getMinutes()).slice(-2);
|
||||
|
||||
if(message.views) {
|
||||
const postAuthor = message.post_author || message.fwd_from?.post_author;
|
||||
|
||||
bubble.classList.add('channel-post');
|
||||
time = formatNumber(message.views, 1) + ' <i class="tgico-channelviews"></i> ' + time;
|
||||
time = formatNumber(message.views, 1) + ' <i class="tgico-channelviews"></i> ' + (postAuthor ? RichTextProcessor.wrapEmojiText(postAuthor) + ', ' : '') + time;
|
||||
|
||||
if(!message.savedFrom) {
|
||||
const forward = document.createElement('div');
|
||||
@ -35,9 +39,14 @@ export namespace MessageRender {
|
||||
time = '<i class="edited">edited</i> ' + time;
|
||||
}
|
||||
|
||||
const title = getFullDate(date)
|
||||
+ (message.edit_date ? `\nEdited: ${getFullDate(new Date(message.edit_date * 1000))}` : '');
|
||||
+ (message.fwd_from ? `\nOriginal: ${getFullDate(new Date(message.fwd_from.date * 1000))}` : '');
|
||||
|
||||
const timeSpan = document.createElement('span');
|
||||
timeSpan.classList.add('time', 'tgico');
|
||||
timeSpan.innerHTML = `${time}<div class="inner tgico">${time}</div>`;
|
||||
timeSpan.title = title;
|
||||
timeSpan.innerHTML = `${time}<div class="inner tgico" title="${title}">${time}</div>`;
|
||||
|
||||
messageDiv.append(timeSpan);
|
||||
|
||||
|
@ -29,4 +29,9 @@ export const formatDateAccordingToToday = (time: Date) => {
|
||||
}
|
||||
|
||||
return timeStr;
|
||||
};
|
||||
|
||||
export const getFullDate = (date: Date) => {
|
||||
return date.getDate() + ' ' + months[date.getMonth()] + ' ' + date.getFullYear() +
|
||||
', ' + ('0' + date.getHours()).slice(-2) + ':' + ('0' + date.getMinutes()).slice(-2) + ':' + ('0' + date.getSeconds()).slice(-2);
|
||||
};
|
@ -545,8 +545,9 @@ export class AppDialogsManager {
|
||||
}
|
||||
|
||||
public setListClickListener(list: HTMLUListElement, onFound?: () => void, withContext = false) {
|
||||
list.addEventListener('click', (e: Event) => {
|
||||
cancelEvent(e);
|
||||
list.addEventListener('mousedown', (e) => {
|
||||
if(e.button != 0) return;
|
||||
//cancelEvent(e);
|
||||
|
||||
this.log('dialogs click list');
|
||||
let target = e.target as HTMLElement;
|
||||
|
@ -1020,6 +1020,7 @@ $bubble-margin: .25rem;
|
||||
align-items: center;
|
||||
padding: 0 2.5px;
|
||||
line-height: 20px;
|
||||
pointer-events: all; // show title
|
||||
|
||||
.inner {
|
||||
display: none;
|
||||
@ -1034,6 +1035,7 @@ $bubble-margin: .25rem;
|
||||
user-select: none;
|
||||
line-height: 1;
|
||||
vertical-align: middle;
|
||||
pointer-events: none; // do not show title
|
||||
/* display: inline-flex;
|
||||
align-items: center; */
|
||||
|
||||
@ -1049,6 +1051,7 @@ $bubble-margin: .25rem;
|
||||
}
|
||||
|
||||
.inner {
|
||||
pointer-events: all;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user