[mirotalksfu] - add delete msg btn and tippy
هذا الالتزام موجود في:
@@ -2151,7 +2151,7 @@ class RoomClient {
|
|||||||
: `<hr/><button class="msger-reply-btn" onclick="rc.sendMessageTo('${fromId}','${fromName}')">${_PEER.sendMsg} Reply (private)</button>`;
|
: `<hr/><button class="msger-reply-btn" onclick="rc.sendMessageTo('${fromId}','${fromName}')">${_PEER.sendMsg} Reply (private)</button>`;
|
||||||
let message = toId == 'all' ? msg : msg + replyMsg;
|
let message = toId == 'all' ? msg : msg + replyMsg;
|
||||||
let msgHTML = `
|
let msgHTML = `
|
||||||
<div class="msg ${side}-msg">
|
<div id="msg-${chatMessagesId}" class="msg ${side}-msg">
|
||||||
<div class="msg-img" style="background-image: url('${img}')"></div>
|
<div class="msg-img" style="background-image: url('${img}')"></div>
|
||||||
<div class=${msgBubble}>
|
<div class=${msgBubble}>
|
||||||
<div class="msg-info">
|
<div class="msg-info">
|
||||||
@@ -2161,6 +2161,12 @@ class RoomClient {
|
|||||||
<div id="${chatMessagesId}" class="msg-text">${message}
|
<div id="${chatMessagesId}" class="msg-text">${message}
|
||||||
<hr/>
|
<hr/>
|
||||||
<button
|
<button
|
||||||
|
id="msg-delete-${chatMessagesId}"
|
||||||
|
class="fas fa-trash"
|
||||||
|
onclick="rc.deleteMessage('msg-${chatMessagesId}')"
|
||||||
|
></button>
|
||||||
|
<button
|
||||||
|
id="msg-copy-${chatMessagesId}"
|
||||||
class="fas fa-copy"
|
class="fas fa-copy"
|
||||||
onclick="rc.copyToClipboard('${chatMessagesId}')"
|
onclick="rc.copyToClipboard('${chatMessagesId}')"
|
||||||
></button>
|
></button>
|
||||||
@@ -2171,11 +2177,36 @@ class RoomClient {
|
|||||||
this.collectMessages(time, fromName, msg);
|
this.collectMessages(time, fromName, msg);
|
||||||
chatMsger.insertAdjacentHTML('beforeend', msgHTML);
|
chatMsger.insertAdjacentHTML('beforeend', msgHTML);
|
||||||
chatMsger.scrollTop += 500;
|
chatMsger.scrollTop += 500;
|
||||||
|
this.setTippy('msg-delete-' + chatMessagesId, 'Delete', 'top');
|
||||||
|
this.setTippy('msg-copy-' + chatMessagesId, 'Copy', 'top');
|
||||||
chatMessagesId++;
|
chatMessagesId++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deleteMessage(id) {
|
||||||
|
Swal.fire({
|
||||||
|
background: swalBackground,
|
||||||
|
position: 'center',
|
||||||
|
title: 'Delete this Message?',
|
||||||
|
imageUrl: image.delete,
|
||||||
|
showDenyButton: true,
|
||||||
|
confirmButtonText: `Yes`,
|
||||||
|
denyButtonText: `No`,
|
||||||
|
showClass: {
|
||||||
|
popup: 'animate__animated animate__fadeInDown',
|
||||||
|
},
|
||||||
|
hideClass: {
|
||||||
|
popup: 'animate__animated animate__fadeOutUp',
|
||||||
|
},
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
this.getId(id).remove();
|
||||||
|
this.sound('delete');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
copyToClipboard(id) {
|
copyToClipboard(id) {
|
||||||
const text = document.getElementById(id).innerText;
|
const text = this.getId(id).innerText;
|
||||||
navigator.clipboard
|
navigator.clipboard
|
||||||
.writeText(text)
|
.writeText(text)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم