-
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mirotalkc2c] - add chat emoji picker
- Loading branch information
1 parent
67f9e3a
commit 4a24452
Showing
5 changed files
with
54 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
* @license For private project or commercial purposes contact us at: [email protected] or purchase it directly via Code Canyon: | ||
* @license https://codecanyon.net/item/mirotalk-c2c-webrtc-real-time-cam-2-cam-video-conferences-and-screen-sharing/43383005 | ||
* @author Miroslav Pejic - [email protected] | ||
* @version 1.1.31 | ||
* @version 1.1.32 | ||
*/ | ||
|
||
require('dotenv').config(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
* @license For private project or commercial purposes contact us at: [email protected] or purchase it directly via Code Canyon: | ||
* @license https://codecanyon.net/item/mirotalk-c2c-webrtc-real-time-cam-2-cam-video-conferences-and-screen-sharing/43383005 | ||
* @author Miroslav Pejic - [email protected] | ||
* @version 1.1.31 | ||
* @version 1.1.32 | ||
*/ | ||
|
||
const roomId = new URLSearchParams(window.location.search).get('room'); | ||
|
@@ -50,7 +50,9 @@ const chatOpenBtn = document.getElementById('chatOpenBtn'); | |
const chatBody = document.getElementById('chatBody'); | ||
const chatCloseBtn = document.getElementById('chatCloseBtn'); | ||
const chatInput = document.getElementById('chatInput'); | ||
const chatEmojiBtn = document.getElementById('chatEmojiBtn'); | ||
const chatSendBtn = document.getElementById('chatSendBtn'); | ||
const chatEmoji = document.getElementById('chatEmoji'); | ||
|
||
const roomURL = window.location.origin + '/?room=' + roomId; | ||
|
||
|
@@ -215,6 +217,7 @@ function thereIsPeerConnections() { | |
|
||
document.addEventListener('DOMContentLoaded', function () { | ||
initClient(); | ||
handleChatEmojiPicker(); | ||
}); | ||
|
||
function initClient() { | ||
|
@@ -885,6 +888,9 @@ function handleEvents() { | |
chatCloseBtn.onclick = () => { | ||
toggleChat(); | ||
}; | ||
chatEmojiBtn.onclick = () => { | ||
toggleChatEmoji(); | ||
}; | ||
chatSendBtn.onclick = () => { | ||
sendMessage(); | ||
}; | ||
|
@@ -1443,6 +1449,25 @@ function toggleChat() { | |
} | ||
} | ||
|
||
function toggleChatEmoji(){ | ||
chatEmoji.classList.toggle('show'); | ||
} | ||
|
||
function handleChatEmojiPicker() { | ||
const pickerOptions = { | ||
theme: 'dark', | ||
perLine: 8, | ||
onEmojiSelect: addEmojiToMsg, | ||
}; | ||
const emojiPicker = new EmojiMart.Picker(pickerOptions); | ||
chatEmoji.appendChild(emojiPicker); | ||
|
||
function addEmojiToMsg(data) { | ||
chatInput.value += data.native; | ||
toggleChatEmoji(); | ||
} | ||
} | ||
|
||
function sendMessage() { | ||
console.log(typeof chatInput.value); | ||
if (!chatInput.value) return; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters